Trait PHPMock
Adds building a function mock functionality into \PHPUnit\Framework\TestCase.
Use this trait in your \PHPUnit\Framework\TestCase:
<?php namespace foo; class FooTest extends \PHPUnit\Framework\TestCase { use \phpmock\phpunit\PHPMock; public function testBar() { $time = $this->getFunctionMock(__NAMESPACE__, "time"); $time->expects($this->once())->willReturn(3); $this->assertEquals(3, time()); } }
Namespace: phpmock\phpunit
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at PHPMock.php
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at PHPMock.php
public
PHPUnit_Framework_MockObject_MockObject
|
|
public
|
#
registerForTearDown( phpmock\Deactivatable $deactivatable )
Automatically disable function mocks after the test was run. |
public static
|
#
defineFunctionMock( string $namespace, string $name )
Defines the mocked function in the given namespace. |