You are here

public function Framework_MockObjectTest::testStubbedReturnValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php \Framework_MockObjectTest::testStubbedReturnValue()

File

vendor/phpunit/phpunit-mock-objects/tests/MockObjectTest.php, line 168

Class

Framework_MockObjectTest
@since Class available since Release 3.0.0

Code

public function testStubbedReturnValue() {
  $mock = $this
    ->getMock('AnInterface');
  $mock
    ->expects($this
    ->any())
    ->method('doSomething')
    ->will($this
    ->returnValue('something'));
  $this
    ->assertEquals('something', $mock
    ->doSomething());
  $mock = $this
    ->getMock('AnInterface');
  $mock
    ->expects($this
    ->any())
    ->method('doSomething')
    ->willReturn('something');
  $this
    ->assertEquals('something', $mock
    ->doSomething());
}