ConsecutiveParametersTest.php (1257B)
1 <?php 2 class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase 3 { 4 public function testIntegration() 5 { 6 $mock = $this->getMock('stdClass', array('foo')); 7 $mock 8 ->expects($this->any()) 9 ->method('foo') 10 ->withConsecutive( 11 array('bar'), 12 array(21, 42) 13 ); 14 $mock->foo('bar'); 15 $mock->foo(21, 42); 16 } 17 18 public function testIntegrationWithLessAssertionsThenMethodCalls() 19 { 20 $mock = $this->getMock('stdClass', array('foo')); 21 $mock 22 ->expects($this->any()) 23 ->method('foo') 24 ->withConsecutive( 25 array('bar') 26 ); 27 $mock->foo('bar'); 28 $mock->foo(21, 42); 29 } 30 31 public function testIntegrationExpectingException() 32 { 33 $mock = $this->getMock('stdClass', array('foo')); 34 $mock 35 ->expects($this->any()) 36 ->method('foo') 37 ->withConsecutive( 38 array('bar'), 39 array(21, 42) 40 ); 41 $mock->foo('bar'); 42 $this->setExpectedException('PHPUnit_Framework_ExpectationFailedException'); 43 $mock->foo('invalid'); 44 } 45 }