Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Fix tests for yp_first and yp_next
Browse files Browse the repository at this point in the history
There is no guarantee of lexical order
  • Loading branch information
Gasol committed Feb 24, 2014
1 parent 0f42256 commit 6af78f5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
38 changes: 38 additions & 0 deletions tests/007-yp_first-and-yp_next.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--TEST--
yp_first() and yp_order() function test
--SKIPIF--
<?php if (!extension_loaded('yp')) die('Skip yp extension not loaded'); ?>
--FILE--
<?php
$domain = yp_get_default_domain();
$mapname = 'group.byname';

var_dump(YPERR_NOMORE !== yp_errno());

$first = yp_first($domain, $mapname);
$groups[] = current($first);
$name = key($first);
while ($next = yp_next($domain, $mapname, $name)) {
$name = key($next);
$group = current($next);
$groups[] = $group;
}
var_dump($next);
var_dump(YPERR_NOMORE === yp_errno());
sort($groups);
var_dump($groups);
?>
--EXPECTF--
bool(true)

Warning: yp_next(): No more records in map database in %s/tests/007-yp_first.php on line 10
bool(false)
bool(true)
array(3) {
[0]=>
string(14) "puppet:x:1001:"
[1]=>
string(15) "vagrant:x:1000:"
[2]=>
string(14) "vboxsf:x:1002:"
}
19 changes: 0 additions & 19 deletions tests/007-yp_first.phpt

This file was deleted.

0 comments on commit 6af78f5

Please sign in to comment.