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


PHP PHPUnit_Framework_TestCase::assignMockCallbacks方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::assignMockCallbacks方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::assignMockCallbacks方法的具体用法?PHP PHPUnit_Framework_TestCase::assignMockCallbacks怎么用?PHP PHPUnit_Framework_TestCase::assignMockCallbacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


在下文中一共展示了PHPUnit_Framework_TestCase::assignMockCallbacks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Creates an instance of the mock JAccessRules object.
  *
  * @param   PHPUnit_Framework_TestCase  $test  A test object.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test)
 {
     // Mock all the public methods.
     $methods = array('allow');
     // Create the mock.
     $mockObject = $test->getMock('JAccessRules', $methods, array(), '', false);
     $test->assignMockCallbacks($mockObject, array('allow' => array(get_called_class(), 'mockAllow')));
     return $mockObject;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:18,代码来源:rules.php

示例2: create

 /**
  * Creates and instance of the mock JLanguage object.
  *
  * @param   PHPUnit_Framework_TestCase  $test  A test object.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test)
 {
     // Collect all the relevant methods in JDatabase.
     $methods = array('_', 'getInstance', 'getTag', 'test');
     // Create the mock.
     $mockObject = $test->getMock('JLanguage', $methods, array(), '', false);
     // Mock selected methods.
     $test->assignMockReturns($mockObject, array('getInstance' => $mockObject, 'getTag' => 'en-GB', 'test' => 'ok'));
     $test->assignMockCallbacks($mockObject, array('_' => array(get_called_class(), 'mock_')));
     return $mockObject;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:20,代码来源:language.php

示例3: create

 /**
  * Creates and instance of the mock JDatabaseDriver object.
  *
  * @param   PHPUnit_Framework_TestCase  $test          A test object.
  * @param   string                      $driver        Optional driver to create a sub-class of JDatabaseDriver.
  * @param   array                       $extraMethods  An array of additional methods to add to the mock.
  * @param   string                      $nullDate      A null date string for the driver.
  * @param   string                      $dateFormat    A date format for the driver.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test, $driver = '', array $extraMethods = array(), $nullDate = '0000-00-00 00:00:00', $dateFormat = 'Y-m-d H:i:s')
 {
     // Collect all the relevant methods in JDatabaseDriver.
     $methods = array_merge($extraMethods, array('connect', 'connected', 'disconnect', 'dropTable', 'escape', 'execute', 'fetchArray', 'fetchAssoc', 'fetchObject', 'freeResult', 'getAffectedRows', 'getCollation', 'getConnectors', 'getDateFormat', 'getErrorMsg', 'getErrorNum', 'getInstance', 'getLog', 'getNullDate', 'getNumRows', 'getPrefix', 'getQuery', 'getTableColumns', 'getTableCreate', 'getTableKeys', 'getTableList', 'getUtfSupport', 'getVersion', 'insertId', 'insertObject', 'loadAssoc', 'loadAssocList', 'loadColumn', 'loadObject', 'loadObjectList', 'loadResult', 'loadRow', 'loadRowList', 'lockTable', 'query', 'quote', 'quoteName', 'renameTable', 'replacePrefix', 'select', 'setQuery', 'setUTF', 'splitSql', 'test', 'isSupported', 'transactionCommit', 'transactionRollback', 'transactionStart', 'unlockTables', 'updateObject'));
     // Create the mock.
     $mockObject = $test->getMock('JDatabaseDriver' . $driver, $methods, array(), '', false);
     // Mock selected methods.
     $test->assignMockReturns($mockObject, array('getNullDate' => $nullDate, 'getDateFormat' => $dateFormat));
     $test->assignMockCallbacks($mockObject, array('escape' => array(is_callable(array($test, 'mockEscape')) ? $test : __CLASS__, 'mockEscape'), 'getQuery' => array(is_callable(array($test, 'mockGetQuery')) ? $test : __CLASS__, 'mockGetQuery'), 'quote' => array(is_callable(array($test, 'mockQuote')) ? $test : __CLASS__, 'mockQuote'), 'quoteName' => array(is_callable(array($test, 'mockQuoteName')) ? $test : __CLASS__, 'mockQuoteName'), 'setQuery' => array(is_callable(array($test, 'mockSetQuery')) ? $test : __CLASS__, 'mockSetQuery')));
     return $mockObject;
 }
开发者ID:n3t,项目名称:joomla-cms,代码行数:24,代码来源:driver.php

示例4: create

 /**
  * Creates an instance of the mock JSession object.
  *
  * @param   PHPUnit_Framework_TestCase  $test     A test object.
  * @param   array                       $options  An array of optional configuration values.
  *                                                getId : the value to be returned by the mock getId method
  *                                                get.user.id : the value to assign to the user object id returned by get('user')
  *                                                get.user.name : the value to assign to the user object name returned by get('user')
  *                                                get.user.username : the value to assign to the user object username returned by get('user')
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test, $options = array())
 {
     if (is_array($options)) {
         self::$options = $options;
     }
     // Mock all the public methods.
     $methods = array('clear', 'close', 'destroy', 'fork', 'get', 'getExpire', 'getFormToken', 'getId', 'getInstance', 'getName', 'getState', 'getStores', 'getToken', 'has', 'hasToken', 'getPrefix', 'isNew', 'restart', 'set');
     // Create the mock.
     $mockObject = $test->getMock('JSession', $methods, array(), '', false);
     // Mock selected methods.
     $test->assignMockReturns($mockObject, array('getId' => self::getOption('getId')));
     $test->assignMockCallbacks($mockObject, array('get' => array(get_called_class(), 'mockGet')));
     return $mockObject;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:28,代码来源:session.php

示例5: create

 /**
  * Creates and instance of the mock JEventDispatcher object.
  *
  * @param   PHPUnit_Framework_TestCase  $test        A test object.
  * @param   boolean                     $defaults  True to create the default mock handlers and triggers.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test, $defaults = true)
 {
     // Clear the static tracker properties.
     self::$handlers = array();
     self::$triggered = array();
     // Collect all the relevant methods in JEventDispatcher.
     $methods = array('register', 'trigger', 'test');
     // Create the mock.
     $mockObject = $test->getMock('JEventDispatcher', $methods, array(), '', false);
     // Mock selected methods.
     $test->assignMockReturns($mockObject, array('test' => 'ok'));
     if ($defaults) {
         $test->assignMockCallbacks($mockObject, array('register' => array(get_called_class(), 'mockRegister'), 'trigger' => array(get_called_class(), 'mockTrigger')));
     }
     return $mockObject;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:26,代码来源:dispatcher.php

示例6: create

 /**
  * Creates and instance of the mock DispatcherInterface object.
  *
  * @param   PHPUnit_Framework_TestCase  $test      A test object.
  * @param   boolean                     $defaults  True to create the default mock handlers and triggers.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   11.3
  */
 public static function create($test, $defaults = true)
 {
     // Clear the static tracker properties.
     self::$handlers = array();
     self::$triggered = array();
     // Collect all the relevant methods in DispatcherInterface.
     $methods = array('addListener', 'dispatch', 'register', 'removeListener', 'trigger', 'test');
     // Create the mock.
     $mockObject = $test->getMockBuilder(DispatcherInterface::class)->setMethods($methods)->getMock();
     // Mock selected methods.
     $test->assignMockReturns($mockObject, array('test' => 'ok'));
     if ($defaults) {
         $test->assignMockCallbacks($mockObject, array('dispatch' => array(get_called_class(), 'mockDispatch'), 'addListener' => array(get_called_class(), 'mockRegister')));
     }
     return $mockObject;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:26,代码来源:dispatcher.php

示例7: createInputJson

 /**
  * Creates an instance of a mock JInputJson object.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   3.4
  */
 public function createInputJson()
 {
     $mockObject = $this->createInput(array('methods' => array('getRaw')));
     self::$test->assignMockCallbacks($mockObject, array('getRaw' => array(is_callable(array(self::$test, 'mockInputGetRaw')) ? self::$test : $this, 'mockInputGetRaw')));
     return $mockObject;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:13,代码来源:input.php


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