Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -70,7 +70,7 @@ class ConfigEntityMapperTest extends UnitTestCase {
$definition = array(
'class' => '\Drupal\config_translation\ConfigEntityMapper',
'base_route_name' => 'entity.configurable_language.edit_form',
'title' => '!label language',
'title' => '@label language',
'names' => array(),
'entity_type' => 'configurable_language',
'route_name' => 'config_translation.item.overview.entity.configurable_language.edit_form',
@ -99,9 +99,9 @@ class ConfigEntityMapperTest extends UnitTestCase {
}
/**
* Tests ConfigEntityMapper::setEntity().
* Tests ConfigEntityMapper::setEntity() and ConfigEntityMapper::getEntity().
*/
public function testSetEntity() {
public function testEntityGetterAndSetter() {
$this->entity
->expects($this->once())
->method('id')
@ -119,9 +119,15 @@ class ConfigEntityMapperTest extends UnitTestCase {
->with('configurable_language')
->will($this->returnValue($entity_type));
// No entity is set.
$this->assertNull($this->configEntityMapper->getEntity());
$result = $this->configEntityMapper->setEntity($this->entity);
$this->assertTrue($result);
// Ensure that the getter provides the entity.
$this->assertEquals($this->entity, $this->configEntityMapper->getEntity());
// 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']));

View file

@ -50,7 +50,7 @@ class ConfigFieldMapperTest extends UnitTestCase {
$definition = array(
'class' => '\Drupal\config_translation\ConfigFieldMapper',
'base_route_name' => 'entity.field_config.node_field_edit_form',
'title' => '!label field',
'title' => '@label field',
'names' => array(),
'entity_type' => 'field_config',
);

View file

@ -11,6 +11,7 @@ use Drupal\config_translation\ConfigNamesMapper;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\Language;
use Drupal\Core\Routing\RouteMatch;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Route;
@ -140,7 +141,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
*/
public function testGetTitle() {
$result = $this->configNamesMapper->getTitle();
$this->assertSame($this->pluginDefinition['title'], $result);
$this->assertSame($this->pluginDefinition['title'], (string) $result);
}
/**
@ -239,9 +240,8 @@ class ConfigNamesMapperTest extends UnitTestCase {
* Tests ConfigNamesMapper::getAddRouteParameters().
*/
public function testGetAddRouteParameters() {
$request = Request::create('');
$request->attributes->set('langcode', 'xx');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'), ['langcode' => 'xx']);
$this->configNamesMapper->populateFromRouteMatch($route_match);
$expected = array('langcode' => 'xx');
$result = $this->configNamesMapper->getAddRouteParameters();
@ -278,9 +278,8 @@ class ConfigNamesMapperTest extends UnitTestCase {
* Tests ConfigNamesMapper::getEditRouteParameters().
*/
public function testGetEditRouteParameters() {
$request = Request::create('');
$request->attributes->set('langcode', 'xx');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'), ['langcode' => 'xx']);
$this->configNamesMapper->populateFromRouteMatch($route_match);
$expected = array('langcode' => 'xx');
$result = $this->configNamesMapper->getEditRouteParameters();
@ -317,9 +316,8 @@ class ConfigNamesMapperTest extends UnitTestCase {
* Tests ConfigNamesMapper::getDeleteRouteParameters().
*/
public function testGetDeleteRouteParameters() {
$request = Request::create('');
$request->attributes->set('langcode', 'xx');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'), ['langcode' => 'xx']);
$this->configNamesMapper->populateFromRouteMatch($route_match);
$expected = array('langcode' => 'xx'); $result = $this->configNamesMapper->getDeleteRouteParameters();
$this->assertSame($expected, $result);
@ -370,25 +368,25 @@ class ConfigNamesMapperTest extends UnitTestCase {
}
/**
* Tests ConfigNamesMapper::populateFromRequest().
* Tests ConfigNamesMapper::populateFromRouteMatch().
*/
public function testPopulateFromRequest() {
public function testPopulateFromRouteMatch() {
// Make sure the language code is not set initially.
$this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
// Test that an empty request does not set the language code.
$request = Request::create('');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'));
$this->configNamesMapper->populateFromRouteMatch($route_match);
$this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
// Test that a request with a 'langcode' attribute sets the language code.
$request->attributes->set('langcode', 'xx');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'), ['langcode' => 'xx']);
$this->configNamesMapper->populateFromRouteMatch($route_match);
$this->assertSame('xx', $this->configNamesMapper->getInternalLangcode());
// Test that the language code gets unset with the wrong request.
$request->attributes->remove('langcode');
$this->configNamesMapper->populateFromRequest($request);
$route_match = new RouteMatch('example', new Route('/test/{langcode}'));
$this->configNamesMapper->populateFromRouteMatch($route_match);
$this->assertSame(NULL, $this->configNamesMapper->getInternalLangcode());
}
@ -397,7 +395,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
*/
public function testGetTypeLabel() {
$result = $this->configNamesMapper->getTypeLabel();
$this->assertSame($this->pluginDefinition['title'], $result);
$this->assertSame($this->pluginDefinition['title'], (string) $result);
}
/**
@ -540,7 +538,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
$map = array();
foreach ($config_names as $i => $config_name) {
$map[] = array($config_name, $mock_return_values[$i]);
$map[] = isset($mock_return_values[$i]) ? array($config_name, $mock_return_values[$i]) : array();
}
$this->configMapperManager
->expects($this->any())
@ -562,10 +560,12 @@ class ConfigNamesMapperTest extends UnitTestCase {
*/
public function providerTestHasTranslatable() {
return array(
array(array(), FALSE),
array(array(TRUE), TRUE),
array(array(FALSE), FALSE),
array(array(TRUE, TRUE, TRUE), TRUE),
array(array(TRUE, FALSE, TRUE), FALSE),
array(array(FALSE, FALSE, FALSE), FALSE),
array(array(TRUE, FALSE, TRUE), TRUE),
);
}
@ -624,7 +624,7 @@ class ConfigNamesMapperTest extends UnitTestCase {
*/
public function testGetTypeName() {
$result = $this->configNamesMapper->getTypeName();
$this->assertSame('Settings', $result);
$this->assertSame('Settings', (string) $result);
}
/**