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