本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::calculateDependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::calculateDependencies方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::calculateDependencies怎么用?PHP PHPUnit_Framework_MockObject_MockObject::calculateDependencies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::calculateDependencies方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCalculateDependencies
/**
* @covers ::calculateDependencies
*/
public function testCalculateDependencies()
{
$target_entity_type_id = $this->randomMachineName(16);
$target_entity_type = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$target_entity_type->expects($this->any())->method('getProvider')->will($this->returnValue('test_module'));
$values = array('targetEntityType' => $target_entity_type_id);
$this->entityManager->expects($this->at(0))->method('getDefinition')->with($target_entity_type_id)->will($this->returnValue($target_entity_type));
$this->entityManager->expects($this->at(1))->method('getDefinition')->with($this->entityType)->will($this->returnValue($this->entityInfo));
$this->entity = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityDisplayModeBase')->setConstructorArgs(array($values, $this->entityType))->setMethods(array('getFilterFormat'))->getMock();
$dependencies = $this->entity->calculateDependencies()->getDependencies();
$this->assertContains('test_module', $dependencies['module']);
}
示例2: testCalculateDependenciesWithThirdPartySettings
/**
* @covers ::calculateDependencies
*/
public function testCalculateDependenciesWithThirdPartySettings()
{
$this->entity = $this->getMockForAbstractClass('\\Drupal\\Tests\\Core\\Config\\Entity\\Fixtures\\ConfigEntityBaseWithThirdPartySettings', array(array(), $this->entityTypeId));
$this->entity->setThirdPartySetting('test_provider', 'test', 'test');
$this->entity->setThirdPartySetting('test_provider2', 'test', 'test');
$this->entity->setThirdPartySetting($this->provider, 'test', 'test');
$this->assertEquals(array('test_provider', 'test_provider2'), $this->entity->calculateDependencies()['module']);
}
示例3: testCalculateDependenciesTheme
/**
* @covers ::calculateDependencies
*/
public function testCalculateDependenciesTheme()
{
$this->setUpEntity(array('name' => 'test', 'source' => 'test_theme', 'sourceType' => Breakpoint::SOURCE_TYPE_THEME));
$breakpoint = $this->getMockBuilder('\\Drupal\\breakpoint\\Entity\\Breakpoint')->disableOriginalConstructor()->getMock();
$breakpoint->expects($this->once())->method('getConfigDependencyName')->will($this->returnValue('breakpoint.breakpoint.test'));
$this->entity->expects($this->once())->method('getBreakpoints')->will($this->returnValue(array($breakpoint)));
$dependencies = $this->entity->calculateDependencies();
$this->assertArrayNotHasKey('module', $dependencies);
$this->assertContains('test_theme', $dependencies['theme']);
$this->assertContains('breakpoint.breakpoint.test', $dependencies['entity']);
}
示例4: testCalculateDependenciesWithThirdPartySettings
/**
* @covers ::calculateDependencies
* @covers ::getDependencies
* @covers ::onDependencyRemoval
*/
public function testCalculateDependenciesWithThirdPartySettings()
{
$this->entity = $this->getMockForAbstractClass('\\Drupal\\Core\\Config\\Entity\\ConfigEntityBase', array(array(), $this->entityTypeId));
$this->entity->setThirdPartySetting('test_provider', 'test', 'test');
$this->entity->setThirdPartySetting('test_provider2', 'test', 'test');
$this->entity->setThirdPartySetting($this->provider, 'test', 'test');
$this->assertEquals(array('test_provider', 'test_provider2'), $this->entity->calculateDependencies()->getDependencies()['module']);
$changed = $this->entity->onDependencyRemoval(['module' => ['test_provider2']]);
$this->assertTrue($changed, 'Calling onDependencyRemoval with an existing third party dependency provider returns TRUE.');
$changed = $this->entity->onDependencyRemoval(['module' => ['test_provider3']]);
$this->assertFalse($changed, 'Calling onDependencyRemoval with a non-existing third party dependency provider returns FALSE.');
$this->assertEquals(array('test_provider'), $this->entity->calculateDependencies()->getDependencies()['module']);
}
示例5: testCalculateDependenciesWithPluginBags
/**
* @covers ::calculateDependencies
*
* @dataProvider providerCalculateDependenciesWithPluginBags
*/
public function testCalculateDependenciesWithPluginBags($definition, $expected_dependencies)
{
$values = array();
$this->entity = $this->getMockBuilder('\\Drupal\\Tests\\Core\\Config\\Entity\\Fixtures\\ConfigEntityBaseWithPluginBags')->setConstructorArgs(array($values, $this->entityTypeId))->setMethods(array('getPluginBags'))->getMock();
// Create a configurable plugin that would add a dependency.
$instance_id = $this->randomName();
$instance = new TestConfigurablePlugin(array(), $instance_id, $definition);
// Create a plugin bag to contain the instance.
$pluginBag = $this->getMockBuilder('\\Drupal\\Core\\Plugin\\DefaultPluginBag')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
$pluginBag->expects($this->atLeastOnce())->method('get')->with($instance_id)->will($this->returnValue($instance));
$pluginBag->addInstanceId($instance_id);
// Return the mocked plugin bag.
$this->entity->expects($this->once())->method('getPluginBags')->will($this->returnValue(array($pluginBag)));
$this->assertEquals($expected_dependencies, $this->entity->calculateDependencies());
}
示例6: testCalculateDependencies
/**
* @covers ::calculateDependencies
*/
public function testCalculateDependencies()
{
$this->assertSame([], $this->sut->calculateDependencies());
}