1<?php 2class Framework_MockObject_Matcher_ConsecutiveParametersTest extends PHPUnit_Framework_TestCase 3{ 4 public function testIntegration() 5 { 6 $mock = $this->getMockBuilder(stdClass::class) 7 ->setMethods(['foo']) 8 ->getMock(); 9 10 $mock->expects($this->any()) 11 ->method('foo') 12 ->withConsecutive( 13 ['bar'], 14 [21, 42] 15 ); 16 17 $this->assertNull($mock->foo('bar')); 18 $this->assertNull($mock->foo(21, 42)); 19 } 20 21 public function testIntegrationWithLessAssertionsThanMethodCalls() 22 { 23 $mock = $this->getMockBuilder(stdClass::class) 24 ->setMethods(['foo']) 25 ->getMock(); 26 27 $mock->expects($this->any()) 28 ->method('foo') 29 ->withConsecutive( 30 ['bar'] 31 ); 32 33 $this->assertNull($mock->foo('bar')); 34 $this->assertNull($mock->foo(21, 42)); 35 } 36 37 public function testIntegrationExpectingException() 38 { 39 $mock = $this->getMockBuilder(stdClass::class) 40 ->setMethods(['foo']) 41 ->getMock(); 42 43 $mock->expects($this->any()) 44 ->method('foo') 45 ->withConsecutive( 46 ['bar'], 47 [21, 42] 48 ); 49 50 $mock->foo('bar'); 51 52 $this->expectException(PHPUnit_Framework_ExpectationFailedException::class); 53 54 $mock->foo('invalid'); 55 } 56} 57