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


PHP PHPUnit_Framework_TestCase::returnValueMap方法代码示例

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


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

示例1: create

 /**
  * Creates an instance of the mock JMenu object.
  *
  * @param   PHPUnit_Framework_TestCase  $test  A test object.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   3.4
  */
 public static function create(PHPUnit_Framework_TestCase $test, $setDefault = true, $setActive = false)
 {
     // Collect all the relevant methods in JMenu (work in progress).
     $methods = array('getItem', 'setDefault', 'getDefault', 'setActive', 'getActive', 'getItems', 'getParams', 'getMenu', 'authorise', 'load');
     // Create the mock.
     $mockObject = $test->getMock('JMenu', $methods, array(), '', false);
     self::createMenuSampleData();
     $mockObject->expects($test->any())->method('getItem')->will($test->returnValueMap(self::prepareGetItemData()));
     $mockObject->expects($test->any())->method('getMenu')->will($test->returnValue(self::$data));
     if ($setDefault) {
         $mockObject->expects($test->any())->method('getDefault')->will($test->returnValueMap(self::prepareDefaultData()));
     }
     if ($setActive) {
         $mockObject->expects($test->any())->method('getActive')->will($test->returnValue(self::$data[$setActive]));
     }
     return $mockObject;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:26,代码来源:menu.php

示例2: __construct

 /**
  * @param \PHPUnit_Framework_TestCase $testCase
  *
  * @param array $classes
  */
 public function __construct(\PHPUnit_Framework_TestCase $testCase, array $classes = [])
 {
     $configProvider = $testCase->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $entityClassResolver = $testCase->getMockBuilder('Oro\\Bundle\\EntityBundle\\ORM\\EntityClassResolver')->disableOriginalConstructor()->getMock();
     $entityClassResolver->expects($testCase->any())->method('getEntityClass')->willReturnArgument(0);
     $container = $testCase->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $container->expects($testCase->any())->method('get')->will($testCase->returnValueMap([['oro_entity_config.provider.ownership', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $configProvider], ['oro_entity.orm.entity_class_resolver', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $entityClassResolver]]));
     parent::__construct(array_merge(['organization' => 'Oro\\Bundle\\SecurityBundle\\Tests\\Unit\\Acl\\Domain\\Fixtures\\Entity\\Organization', 'business_unit' => 'Oro\\Bundle\\SecurityBundle\\Tests\\Unit\\Acl\\Domain\\Fixtures\\Entity\\BusinessUnit', 'user' => 'Oro\\Bundle\\SecurityBundle\\Tests\\Unit\\Acl\\Domain\\Fixtures\\Entity\\User'], $classes));
     $this->setContainer($container);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:OwnershipMetadataProviderStub.php

示例3: create

 /**
  * Creates an instance of the mock JMenu object.
  *
  * @param   object  $test  A test object.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject
  *
  * @since   3.4
  */
 public static function create(PHPUnit_Framework_TestCase $test)
 {
     $methods = array('getItem', 'setActive', 'getActive', 'getItems');
     // Create the mock.
     $mockObject = $test->getMock('JMenu', $methods, array(), '', false);
     if (count(self::$data) == 0) {
         self::createMenuSampleData();
     }
     $mockObject->expects($test->any())->method('getItem')->will($test->returnValueMap(self::$data));
     $mockObject->expects($test->any())->method('getActive')->will($test->returnValue(self::$data[self::$active]));
     $mockObject->expects($test->any())->method('getItems')->will($test->returnValue(self::$data));
     return $mockObject;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:22,代码来源:menu.php

示例4: returnValueMap

/**
 *
 *
 * @param  array $valueMap
 * @return PHPUnit_Framework_MockObject_Stub_ReturnValueMap
 * @since  Method available since Release 3.6.0
 */
function returnValueMap(array $valueMap)
{
    return PHPUnit_Framework_TestCase::returnValueMap($valueMap);
}
开发者ID:nbalonso,项目名称:MunkiFace,代码行数:11,代码来源:Functions.php


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