예제 #1
0
 /**
  * Tests every when the callback returns false for one of the elements
  *
  * @return void
  */
 public function testEveryReturnFalse()
 {
     $items = ['a' => 1, 'b' => 2, 'c' => 3];
     $collection = new Collection($items);
     $callable = $this->getMock('stdClass', ['__invoke']);
     $callable->expects($this->at(0))->method('__invoke')->with(1, 'a')->will($this->returnValue(true));
     $callable->expects($this->at(1))->method('__invoke')->with(2, 'b')->will($this->returnValue(false));
     $callable->expects($this->exactly(2))->method('__invoke');
     $this->assertFalse($collection->every($callable));
 }