Ejemplo n.º 1
0
 public function testReject()
 {
     // from js
     $odds = __::reject(array(1, 2, 3, 4, 5, 6), function ($num) {
         return $num % 2 === 0;
     });
     $this->assertEquals(array(1, 3, 5), $odds, 'rejected each even number');
     // extra
     $evens = __(array(1, 2, 3, 4, 5, 6))->reject(function ($num) {
         return $num % 2 !== 0;
     });
     $this->assertEquals(array(2, 4, 6), $evens, 'works with OO-style calls');
     // docs
     $this->assertEquals(array(1, 3), __::reject(array(1, 2, 3, 4), function ($num) {
         return $num % 2 === 0;
     }));
 }
 public function testReject()
 {
     // from js
     $odds = __::reject(array(1, 2, 3, 4, 5, 6), function ($num) {
         return $num % 2 === 0;
     });
     $this->assertEquals(array(1, 3, 5), $odds, 'rejected each even number');
     // docs
     $this->assertEquals(array(1, 3), __::reject(array(1, 2, 3, 4), function ($num) {
         return $num % 2 === 0;
     }));
 }