2018-12-29 21:54:25 +01:00
|
|
|
<?php
|
|
|
|
|
2021-03-22 10:28:28 +01:00
|
|
|
class RemoveFromArrayTest extends \PHPUnit\Framework\TestCase
|
|
|
|
{
|
2021-04-13 22:19:16 +02:00
|
|
|
public function testBasic()
|
|
|
|
{
|
2018-12-29 21:54:25 +01:00
|
|
|
$list = array('a','b','c','d');
|
|
|
|
|
|
|
|
list($found, $new) = remove_from_array($list, 'd');
|
|
|
|
$this->assertEquals(1, $found);
|
|
|
|
$this->assertEquals(array('a','b','c'), $new);
|
|
|
|
|
|
|
|
list($found, $new) = remove_from_array($list, 'a');
|
|
|
|
$this->assertEquals(1, $found);
|
|
|
|
$this->assertEquals(array(1 => 'b',2 => 'c',3=>'d'), $new);
|
|
|
|
|
|
|
|
list($found, $new) = remove_from_array($list, 'x');
|
|
|
|
$this->assertEquals(0, $found);
|
|
|
|
$this->assertEquals(array('a','b','c','d'), $new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|