当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::exactly方法代码示例

本文整理汇总了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;
 }
开发者ID:peteraba,项目名称:dm-test,代码行数:28,代码来源:MockFactory.php

示例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);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:22,代码来源:WikiaAppMock.class.php

示例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;
 }
开发者ID:viscat,项目名称:PCCronManagerBundle,代码行数:11,代码来源:EntityManagerMocks.php

示例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);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:12,代码来源:Functions.php

示例5: getCronDispatcherTestMock

 public function getCronDispatcherTestMock($executeBackgroundCommandNumCalls)
 {
     $mock = $this->getBasicMock();
     $mock->expects($this->_testCase->exactly($executeBackgroundCommandNumCalls))->method('executeBackgroundCommand');
     return $mock;
 }
开发者ID:viscat,项目名称:PCCronManagerBundle,代码行数:6,代码来源:CommandExecuteMocks.php

示例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;
 }
开发者ID:viscat,项目名称:PCCronManagerBundle,代码行数:10,代码来源:UpdateCronTaskMocks.php

示例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;
 }
开发者ID:viscat,项目名称:PCCronManagerBundle,代码行数:11,代码来源:CommandValidatorMocks.php

示例8: expectsExactNumberOfCalls

 public function expectsExactNumberOfCalls($number, $method)
 {
     return $this->expects($method, $this->testCase->exactly($number));
 }
开发者ID:schnipseljagd,项目名称:testdatabuilder,代码行数:4,代码来源:MockBuilder.php


注:本文中的PHPUnit_Framework_TestCase::exactly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。