public function testWithout() { $list = array(1, 2, 1, 0, 3, 1, 4); // from js $this->assertEquals(array(1 => 2, 4 => 3, 6 => 4), __::without($list, 0, 1), 'can remove all instances of an object'); $list = array((object) array('one' => 1), (object) array('two' => 2)); $this->assertEquals(2, count(__::without($list, (object) array('one' => 1))), 'uses real object identity for comparisons.'); $this->assertEquals(1, count(__::without($list, $list[0])), 'ditto.'); $func = function () { return __::without(func_get_args(), 0, 1); }; $result = $func(1, 2, 1, 0, 3, 1, 4); $this->assertEquals(array(1 => 2, 4 => 3, 6 => 4), $result, 'works on an arguments object'); $result = __::union(array(1, 2, 3), array(2, 30, 1), array(1, 40, array(1))); $this->assertEquals('1 2 3 30 40 1', join(' ', $result), 'takes the union of a list of nested arrays'); // extra $this->assertEquals(array(4, 5, 6), __(array(4, 5, 6, 7, 8))->without(7, 8), 'works in OO-style calls'); // docs $this->assertEquals(array(5, 4, 4 => 1), __::without(array(5, 4, 3, 2, 1), 3, 2)); }