RemoveFromArrayTest.php 702 B

123456789101112131415161718192021
  1. <?php
  2. class RemoveFromArrayTest extends \PHPUnit\Framework\TestCase {
  3. public function testBasic() {
  4. $list = array('a','b','c','d');
  5. list($found, $new) = remove_from_array($list, 'd');
  6. $this->assertEquals(1, $found);
  7. $this->assertEquals(array('a','b','c'), $new);
  8. list($found, $new) = remove_from_array($list, 'a');
  9. $this->assertEquals(1, $found);
  10. $this->assertEquals(array(1 => 'b',2 => 'c',3=>'d'), $new);
  11. list($found, $new) = remove_from_array($list, 'x');
  12. $this->assertEquals(0, $found);
  13. $this->assertEquals(array('a','b','c','d'), $new);
  14. }
  15. }
  16. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */