Class PHPMockery
Mock built-in PHP functions with Mockery.
<?php namespace foo; use phpmock\mockery\PHPMockery; $mock = PHPMockery::mock(__NAMESPACE__, "time")->andReturn(3); assert (3 == time()); \Mockery::close();
Namespace: phpmock\mockery
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at PHPMockery.php
Methods summary
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at PHPMockery.php
public static
Mockery\Expectation
public static
#
define( string $namespace, string $name )
Defines the mocked function in the given namespace.
Defines the mocked function in the given namespace.
In most cases you don't have to call this method. phpmock\mockery\PHPMockery::mock()
is doing this for you. But if the mock is defined after the first call in the
tested class, the tested class doesn't resolve to the mock. This is
documented in Bug #68541. You therefore have to define the namespaced
function before the first call.
Defining the function has no side effects. If the function was already defined this method does nothing.
Parameters
- $namespace
- The function namespace.
- $name
- The function name.