You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 20, 2023. It is now read-only.
<?php
class Foo
{
}
class Test extends PHPUnit_Framework_TestCase
{
public function testStubbingUndeclaredMethodsWorks()
{
$stub = $this->getMock('Foo', array('bar'));
$stub->expects($this->any())
->method('bar')
->with($this->equalTo('baz'))
->will($this->returnValue('foobarbaz'));
$this->assertEquals('foobarbaz', $stub->bar('baz'));
}
}
Actual Output
sb@vmware ~ % phpunit Test
PHPUnit @package_version@ by Sebastian Bergmann.
F
Time: 0 seconds, Memory: 4.25Mb
There was 1 failure:
1) Test::testStubbingUndeclaredMethodsWorks
Expectation failed for method name is equal to <string:bar> when invoked zero or more times
Parameter count for invocation Foo::bar() is too low.
/usr/local/src/phpunit-mock-objects/PHPUnit/Framework/MockObject/Matcher.php:180
/usr/local/src/phpunit-mock-objects/PHPUnit/Framework/MockObject/InvocationMocker.php:138
/home/sb/Test.php:17
FAILURES!
Tests: 1, Assertions: 0, Failures: 1.
Expected Output
sb@vmware ~ % phpunit Test
PHPUnit @package_version@ by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 4.25Mb
OK (1 test, 2 assertions)