public function testAny() { // from js $this->assertFalse(__::any(array()), 'the empty set'); $this->assertFalse(__::any(array(false, false, false)), 'all false values'); $this->assertTrue(__::any(array(false, false, true)), 'one true value'); $this->assertFalse(__::any(array(1, 11, 29), function ($num) { return $num % 2 === 0; }), 'all odd numbers'); $this->assertTrue(__::any(array(1, 10, 29), function ($num) { return $num % 2 === 0; }), 'an even number'); // extra $this->assertFalse(__::any(array())); $this->assertFalse(__::any(array(null))); $this->assertFalse(__::any(array(0))); $this->assertFalse(__::any(array('0'))); $this->assertTrue(__::any(array(0, 1))); $this->assertTrue(__::any(array(1))); $this->assertTrue(__::any(array('1'))); $this->assertTrue(__::any(array(1, 2, 3, 4))); $this->assertTrue(__(array(1, 2, 3, 4))->any(), 'works with OO-style calls'); $this->assertFalse(__(array(1, 11, 29))->any(function ($num) { return $num % 2 === 0; })); $this->assertTrue(__::some(array(false, false, true)), 'alias as "some"'); $this->assertTrue(__(array(1, 2, 3, 4))->some(), 'aliased as "some"'); // docs $this->assertTrue(__::any(array(1, 2, 3, 4), function ($num) { return $num % 2 === 0; })); $this->assertFalse(__::any(array(1, 2, 3, 4), function ($num) { return $num === 5; })); }