本文整理汇总了PHP中PHPUnit_Framework_TestCase::at方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::at方法的具体用法?PHP PHPUnit_Framework_TestCase::at怎么用?PHP PHPUnit_Framework_TestCase::at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestCase
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestCase::at方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParamsMock
/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
public function getParamsMock()
{
$mockBuilder = new MockBuilder($this->testCase, 'Zend\\Mvc\\Controller\\Plugin\\Params');
$mockBuilder->setMethods(['__invoke']);
$mockBuilder->disableOriginalConstructor();
$paramsMock = $mockBuilder->getMock();
$count = 0;
$params = func_get_args();
foreach ($params as $param) {
$paramsMock->expects($this->testCase->at($count++))->method('__invoke')->willReturn($param);
}
return $paramsMock;
}
示例2: 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());
}
}
示例3: at
/**
* Returns a matcher that matches when the method it is evaluated for
* is invoked at the given $index.
*
* @param integer $index
* @return PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex
* @since Method available since Release 3.0.0
*/
function at($index)
{
return PHPUnit_Framework_TestCase::at($index);
}
示例4: expectsCallAt
public function expectsCallAt($index, $method)
{
return $this->expects($method, $this->testCase->at($index));
}