Skip to content

Instantly share code, notes, and snippets.

@sasezaki
Created March 17, 2013 10:36
Show Gist options
  • Select an option

  • Save sasezaki/5180996 to your computer and use it in GitHub Desktop.

Select an option

Save sasezaki/5180996 to your computer and use it in GitHub Desktop.
--TEST--
Sample TEST
--FILE--
<?php
$users = [
'太郎' => 'male',
'花子' => 'female',
'一郎' => 'male',
];
$users = new CallbackFilterIterator(new ArrayIterator($users), function($c, $k, $i){
return $c === 'male';
});
$expected = array (
'太郎' => 'male',
'一郎' => 'male',
);
var_export(iterator_to_array($users) === $expected);
--EXPECT--
true
@sasezaki
Copy link
Author

can run test by phpunit or pyrus without any hustle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment