public function Framework_MockObjectTest::testVerificationOfMethodNameFailsWithWrongParameters in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php \Framework_MockObjectTest::testVerificationOfMethodNameFailsWithWrongParameters()
File
- vendor/
phpunit/ phpunit-mock-objects/ tests/ MockObjectTest.php, line 569
Class
- Framework_MockObjectTest
- @since Class available since Release 3.0.0
Code
public function testVerificationOfMethodNameFailsWithWrongParameters() {
$mock = $this
->getMock('SomeClass', array(
'right',
'wrong',
), array(), '', true, true, true);
$mock
->expects($this
->once())
->method('right')
->with(array(
'first',
'second',
));
try {
$mock
->right(array(
'second',
));
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this
->assertSame("Expectation failed for method name is equal to <string:right> when invoked 1 time(s)\n" . "Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.\n" . "Failed asserting that two arrays are equal.", $e
->getMessage());
}
try {
$mock
->__phpunit_verify();
$this
->fail('Expected exception');
} catch (PHPUnit_Framework_ExpectationFailedException $e) {
$this
->assertSame("Expectation failed for method name is equal to <string:right> when invoked 1 time(s).\n" . "Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.\n" . "Failed asserting that two arrays are equal.\n" . "--- Expected\n" . "+++ Actual\n" . "@@ @@\n" . " Array (\n" . "- 0 => 'first'\n" . "- 1 => 'second'\n" . "+ 0 => 'second'\n" . " )\n", $e
->getMessage());
}
$this
->resetMockObjects();
}