php|architect - April 2013 by php|architect

php|architect - April 2013 by php|architect

Author:php|architect
Language: eng
Format: epub
Publisher: php|architect
Published: 2013-04-27T04:00:00+00:00


Along the same lines as adding the return value in the PHPUnit example, a return value in Mockery is as follows:

$mockeryMock->shouldReceive('sayHello') ->andReturn("mHello!");

Using Phake is also not very different for this simple example as you can see in Listing 3. One thing that is unique about Phake is having to specify the fully-qualified name of the interface.

Listing 3 namespace Tests\Example; class HelloTest extends \PHPUnit_Framework_TestCase { /** * @test */ public function mockGreeterWithPhake() { $phakeMock = \Phake::mock('\\Example\\Greeter'); $this->assertInstanceOf( "\\Example\\Greeter", $phakeMock ); $this->assertEquals( 'Howdy!', $phakeMock->sayHello() ); } }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.