本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}