本文整理汇总了PHP中PHPUnit_Framework_TestCase::never方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::never方法的具体用法?PHP PHPUnit_Framework_TestCase::never怎么用?PHP PHPUnit_Framework_TestCase::never使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestCase
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestCase::never方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addMockExpectedCalls
/**
* @param \PHPUnit_Framework_MockObject_MockObject $mock
* @param array $expectedCalls
* @param object|null $callbacksContext
*/
public static function addMockExpectedCalls(\PHPUnit_Framework_MockObject_MockObject $mock, array $expectedCalls, $callbacksContext = null)
{
$index = 0;
if ($expectedCalls) {
foreach ($expectedCalls as $expectedCall) {
list($method, $arguments, $result) = $expectedCall;
$methodExpectation = $mock->expects(\PHPUnit_Framework_TestCase::at($index++))->method($method);
$methodExpectation = call_user_func_array(array($methodExpectation, 'with'), $arguments);
if (is_string($result) && $callbacksContext && method_exists($callbacksContext, $result)) {
$result = $callbacksContext->{$result}();
}
$methodExpectation->will(\PHPUnit_Framework_TestCase::returnValue($result));
}
} else {
$mock->expects(\PHPUnit_Framework_TestCase::never())->method(\PHPUnit_Framework_TestCase::anything());
}
}
示例2: never
/**
* Returns a matcher that matches when the method it is evaluated for
* is never executed.
*
* @return PHPUnit_Framework_MockObject_Matcher_InvokedCount
* @since Method available since Release 3.0.0
*/
function never()
{
return PHPUnit_Framework_TestCase::never();
}
示例3: invoke
public function invoke(\PHPUnit_Framework_MockObject_Invocation $invocation)
{
$returnData = parent::invoke($invocation);
if (is_string($returnData)) {
$returnData = array(0, $returnData);
}
$mock = clone $this->mock;
if ($mock instanceof \PHPUnit_Framework_MockObject_MockObject) {
$mock->expects(\PHPUnit_Framework_TestCase::any())->method('getOutput')->will(\PHPUnit_Framework_TestCase::returnValue($returnData[1]));
$mock->expects(\PHPUnit_Framework_TestCase::any())->method('getOutputArray')->will(\PHPUnit_Framework_TestCase::returnValue(explode("\n", $returnData[1])));
$mock->expects(\PHPUnit_Framework_TestCase::any())->method('isExecuted')->will(\PHPUnit_Framework_TestCase::returnValue(TRUE));
$mock->expects(\PHPUnit_Framework_TestCase::any())->method('getExitStatus')->will(\PHPUnit_Framework_TestCase::returnValue($returnData[0]));
$mock->expects(\PHPUnit_Framework_TestCase::never())->method('exec');
$mock->expects(\PHPUnit_Framework_TestCase::never())->method('addArgument');
$mock->expects(\PHPUnit_Framework_TestCase::never())->method('readOutput');
$mock->expects(\PHPUnit_Framework_TestCase::never())->method('kill');
$mock->expects(\PHPUnit_Framework_TestCase::never())->method('readExecutionState');
}
return $mock;
}
示例4: expectsNoCall
public function expectsNoCall($method)
{
return $this->expects($method, $this->testCase->never());
}