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