本文整理汇总了PHP中PHPUnit_Framework_TestCase::exactly方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::exactly方法的具体用法?PHP PHPUnit_Framework_TestCase::exactly怎么用?PHP PHPUnit_Framework_TestCase::exactly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_TestCase
的用法示例。
在下文中一共展示了PHPUnit_Framework_TestCase::exactly方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFlashMessengerPluginMock
/**
* @param int $successCount
* @param int $errorCount
* @param int $infoCount
* @param int $clearCount
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
public function getFlashMessengerPluginMock($successCount = -1, $errorCount = -1, $infoCount = -1, $clearCount = -1)
{
$mockBuilder = new MockBuilder($this->testCase, 'Zend\\Mvc\\Controller\\Plugin\\FlashMessenger');
$mockBuilder->setMethods(['addSuccessMessage', 'addErrorMessage', 'addInfoMessage', 'clearCurrentMessages']);
$mockBuilder->disableOriginalConstructor();
$flashMessengerMock = $mockBuilder->getMock();
if ($successCount > -1) {
$flashMessengerMock->expects($this->testCase->exactly($successCount))->method('addSuccessMessage');
}
if ($errorCount > -1) {
$flashMessengerMock->expects($this->testCase->exactly($errorCount))->method('addErrorMessage');
}
if ($infoCount > -1) {
$flashMessengerMock->expects($this->testCase->exactly($infoCount))->method('addInfoMessage');
}
if ($clearCount > -1) {
$flashMessengerMock->expects($this->testCase->exactly($clearCount))->method('clearCurrentMessages');
}
return $flashMessengerMock;
}
示例2: init
public function init()
{
$wikiaAppArgs = array();
$globalRegistryMock = null;
$functionWrapperMock = null;
$globalRegistryMock = $this->testCase->getMock('WikiaGlobalRegistry', array('get', 'set'));
$globalRegistryMock->expects($this->testCase->any())->method('get')->will($this->testCase->returnCallback(array($this, 'getGlobalCallback')));
if (in_array('runFunction', $this->methods)) {
$functionWrapperMock = $this->testCase->getMock('WikiaFunctionWrapper', array_keys($this->mockedFunctions));
foreach ($this->mockedFunctions as $functionName => $functionData) {
$functionWrapperMock->expects($this->testCase->exactly($functionData['calls']))->method($functionName)->will($this->testCase->returnValue($functionData['value']));
}
}
$wikiaAppArgs[] = $globalRegistryMock;
$wikiaAppArgs[] = null;
// WikiaLocalRegistry
$wikiaAppArgs[] = null;
// WikiaHookDispatcher
$wikiaAppArgs[] = $functionWrapperMock;
$this->mock = $this->testCase->getMock('WikiaApp', array('ajax'), $wikiaAppArgs, '');
F::setInstance('App', $this->mock);
}
示例3: getDeleteCronTaskTestMock
/**
* @param int $removeNumCalls
* @param TblCronTask $cronTask
* @return \Doctrine\ORM\EntityManager|\PHPUnit_Framework_MockObject_MockObject
*/
public function getDeleteCronTaskTestMock($removeNumCalls, TblCronTask $cronTask = null)
{
$mock = $this->getBasicMock();
$mock->expects($this->_testCase->exactly($removeNumCalls))->method('remove')->with($cronTask);
return $mock;
}
示例4: exactly
/**
* Returns a matcher that matches when the method it is evaluated for
* is executed exactly $count times.
*
* @param integer $count
* @return PHPUnit_Framework_MockObject_Matcher_InvokedCount
* @since Method available since Release 3.0.0
*/
function exactly($count)
{
return PHPUnit_Framework_TestCase::exactly($count);
}
示例5: getCronDispatcherTestMock
public function getCronDispatcherTestMock($executeBackgroundCommandNumCalls)
{
$mock = $this->getBasicMock();
$mock->expects($this->_testCase->exactly($executeBackgroundCommandNumCalls))->method('executeBackgroundCommand');
return $mock;
}
示例6: getCronDispatcherTestMock
/**
* @param int $updateLastRunNumCalls
* @return \Trovit\CronManagerBundle\Model\CRUD\UpdateCronTask|\PHPUnit_Framework_MockObject_MockObject
*/
public function getCronDispatcherTestMock($updateLastRunNumCalls)
{
$mock = $this->getBasicMock();
$mock->expects($this->_testCase->exactly($updateLastRunNumCalls))->method('updateLastRun');
return $mock;
}
示例7: getUpdateCronTaskTestMock
/**
* @param int $commandExistsNumCalls
* @param bool $commandExistsReturn
* @return \Trovit\CronManagerBundle\Model\CommandValidator|\PHPUnit_Framework_MockObject_MockObject
*/
public function getUpdateCronTaskTestMock($commandExistsNumCalls, $commandExistsReturn)
{
$mock = $this->getBasicMock();
$mock->expects($this->_testCase->exactly($commandExistsNumCalls))->method('commandExists')->willReturn($commandExistsReturn);
return $mock;
}
示例8: expectsExactNumberOfCalls
public function expectsExactNumberOfCalls($number, $method)
{
return $this->expects($method, $this->testCase->exactly($number));
}