本文整理汇总了PHP中TestCase::assignMockCallbacks方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::assignMockCallbacks方法的具体用法?PHP TestCase::assignMockCallbacks怎么用?PHP TestCase::assignMockCallbacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase
的用法示例。
在下文中一共展示了TestCase::assignMockCallbacks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates and instance of the mock JApplication object.
*
* @param TestCase $test A test object.
* @param array $data Data to prime the cache with.
*
* @return object
*
* @since 12.1
*/
public static function create(TestCase $test, $data = array())
{
self::$cache = $data;
// Collect all the relevant methods in JConfig.
$methods = array(
'get',
'store',
);
// Create the mock.
$mockObject = $test->getMock(
'JCache',
$methods,
// Constructor arguments.
array(),
// Mock class name.
'',
// Call original constructor.
false
);
$test->assignMockCallbacks(
$mockObject,
array(
'get' => array(get_called_class(), 'mockGet'),
'store' => array(get_called_class(), 'mockStore'),
)
);
return $mockObject;
}
示例2: create
/**
* Creates and instance of the mock JApplication object.
*
* @param TestCase $test A test object.
* @param array $data Data to prime the cache with.
*
* @return object
*
* @since 12.1
*/
public static function create(TestCase $test, $data = array())
{
self::$cache = $data;
// Collect all the relevant methods in JConfig.
$methods = array('get', 'store');
// Create the mock.
$mockObject = $test->getMock('JCache', $methods, array(), '', false);
$test->assignMockCallbacks($mockObject, array('get' => array(get_called_class(), 'mockGet'), 'store' => array(get_called_class(), 'mockStore')));
return $mockObject;
}