Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -57,7 +57,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
$this->entity = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityInterface');
$this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
@ -109,6 +109,10 @@ class ConfigEntityMapperTest extends UnitTestCase {
->will($this->returnValue('entity_id'));
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type
->expects($this->any())
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
->expects($this->once())
->method('getDefinition')
@ -118,6 +122,10 @@ class ConfigEntityMapperTest extends UnitTestCase {
$result = $this->configEntityMapper->setEntity($this->entity);
$this->assertTrue($result);
// Ensure that the configuration name was added to the mapper.
$plugin_definition = $this->configEntityMapper->getPluginDefinition();
$this->assertTrue(in_array('config_prefix.entity_id', $plugin_definition['names']));
// Make sure setEntity() returns FALSE when called a second time.
$result = $this->configEntityMapper->setEntity($this->entity);
$this->assertFalse($result);

View file

@ -0,0 +1,116 @@
<?php
/**
* @file
* Contains \Drupal\Tests\config_translation\Unit\ConfigFieldMapperTest.
*/
namespace Drupal\Tests\config_translation\Unit;
use Drupal\config_translation\ConfigFieldMapper;
use Drupal\Tests\UnitTestCase;
/**
* Tests the functionality provided by the configuration field mapper.
*
* @group config_translation
*
* @coversDefaultClass \Drupal\config_translation\ConfigFieldMapper
*/
class ConfigFieldMapperTest extends UnitTestCase {
/**
* The configuration field mapper to test.
*
* @var \Drupal\config_translation\ConfigFieldMapper
*/
protected $configFieldMapper;
/**
* The field config instance used for testing.
*
* @var \Drupal\field\FieldConfigInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entity;
/**
* The entity manager used for testing.
*
* @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entityManager;
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$this->entity = $this->getMock('Drupal\field\FieldConfigInterface');
$definition = array(
'class' => '\Drupal\config_translation\ConfigFieldMapper',
'base_route_name' => 'entity.field_config.node_field_edit_form',
'title' => '!label field',
'names' => array(),
'entity_type' => 'field_config',
);
$locale_config_manager = $this->getMockBuilder('Drupal\locale\LocaleConfigManager')
->disableOriginalConstructor()
->getMock();
$this->configFieldMapper = new ConfigFieldMapper(
'node_fields',
$definition,
$this->getConfigFactoryStub(),
$this->getMock('Drupal\Core\Config\TypedConfigManagerInterface'),
$locale_config_manager,
$this->getMock('Drupal\config_translation\ConfigMapperManagerInterface'),
$this->getMock('Drupal\Core\Routing\RouteProviderInterface'),
$this->getStringTranslationStub(),
$this->entityManager,
$this->getMock('Drupal\Core\Language\LanguageManagerInterface')
);
}
/**
* Tests ConfigFieldMapper::setEntity().
*
* @covers ::setEntity
*/
public function testSetEntity() {
$entity_type = $this->getMock('Drupal\Core\Config\Entity\ConfigEntityTypeInterface');
$entity_type
->expects($this->any())
->method('getConfigPrefix')
->will($this->returnValue('config_prefix'));
$this->entityManager
->expects($this->any())
->method('getDefinition')
->will($this->returnValue($entity_type));
$field_storage = $this->getMock('Drupal\field\FieldStorageConfigInterface');
$field_storage
->expects($this->any())
->method('id')
->will($this->returnValue('field_storage_id'));
$this->entity
->expects($this->any())
->method('getFieldStorageDefinition')
->will($this->returnValue($field_storage));
$result = $this->configFieldMapper->setEntity($this->entity);
$this->assertTrue($result);
// Ensure that the configuration name was added to the mapper.
$plugin_definition = $this->configFieldMapper->getPluginDefinition();
$this->assertTrue(in_array('config_prefix.field_storage_id', $plugin_definition['names']));
// Make sure setEntity() returns FALSE when called a second time.
$result = $this->configFieldMapper->setEntity($this->entity);
$this->assertFalse($result);
}
}