Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -65,8 +65,14 @@ function config_file_download($uri) {
|
|||
$scheme = file_uri_scheme($uri);
|
||||
$target = file_uri_target($uri);
|
||||
if ($scheme == 'temporary' && $target == 'config.tar.gz') {
|
||||
$request = \Drupal::request();
|
||||
$date = DateTime::createFromFormat('U', $request->server->get('REQUEST_TIME'));
|
||||
$date_string = $date->format('Y-m-d-H-i');
|
||||
$hostname = str_replace('.', '-', $request->getHttpHost());
|
||||
$filename = 'config' . '-' . $hostname . '-' . $date_string. '.tar.gz';
|
||||
$disposition = 'attachment; filename="' . $filename . '"';
|
||||
return array(
|
||||
'Content-disposition' => 'attachment; filename="config.tar.gz"',
|
||||
'Content-disposition' => $disposition,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfigEntityListTest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('config_test');
|
||||
public static $modules = ['block', 'config_test'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -33,6 +33,7 @@ class ConfigEntityListTest extends WebTestBase {
|
|||
// Delete the override config_test entity since it is not required by this
|
||||
// test.
|
||||
\Drupal::entityManager()->getStorage('config_test')->load('override')->delete();
|
||||
$this->drupalPlaceBlock('local_actions_block');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,13 @@ class ConfigExportUITest extends WebTestBase {
|
|||
$this->drupalPostForm('admin/config/development/configuration/full/export', array(), t('Export'));
|
||||
$this->assertResponse(200, 'User can access the download callback.');
|
||||
|
||||
// Test if header contains file name with hostname and timestamp.
|
||||
$request = \Drupal::request();
|
||||
$hostname = str_replace('.', '-', $request->getHttpHost());
|
||||
$header_content_disposition = $this->drupalGetHeader('content-disposition');
|
||||
$header_match = (boolean) preg_match('/attachment; filename="config-' . preg_quote($hostname) . '-\d{4}-\d{2}-\d{2}-\d{2}-\d{2}\.tar\.gz"/', $header_content_disposition);
|
||||
$this->assertTrue($header_match, "Header with filename matches the expected format.");
|
||||
|
||||
// Get the archived binary file provided to user for download.
|
||||
$archive_data = $this->getRawContent();
|
||||
|
||||
|
|
|
@ -121,16 +121,16 @@ class ConfigFileContentTest extends KernelTestBase {
|
|||
$this->assertNull($config->get('i.dont.exist'), 'Non-existent nested value returned NULL.');
|
||||
|
||||
// Read false value.
|
||||
$this->assertEqual($config->get($false_key), '0', format_string("Boolean FALSE value returned the string '0'."));
|
||||
$this->assertEqual($config->get($false_key), '0', "Boolean FALSE value returned the string '0'.");
|
||||
|
||||
// Read true value.
|
||||
$this->assertEqual($config->get($true_key), '1', format_string("Boolean TRUE value returned the string '1'."));
|
||||
$this->assertEqual($config->get($true_key), '1', "Boolean TRUE value returned the string '1'.");
|
||||
|
||||
// Read null value.
|
||||
$this->assertIdentical($config->get('null'), NULL);
|
||||
|
||||
// Read false that had been nested in an array value.
|
||||
$this->assertEqual($config->get($casting_array_false_value_key), '0', format_string("Nested boolean FALSE value returned the string '0'."));
|
||||
$this->assertEqual($config->get($casting_array_false_value_key), '0', "Nested boolean FALSE value returned the string '0'.");
|
||||
|
||||
// Unset a top level value.
|
||||
$config->clear($key);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
@ -275,23 +276,41 @@ class ConfigImportUITest extends WebTestBase {
|
|||
$change_key = 'foo';
|
||||
$remove_key = '404';
|
||||
$add_key = 'biff';
|
||||
$add_data = 'bangpow';
|
||||
$change_data = 'foobar';
|
||||
$add_data = '<em>bangpow</em>';
|
||||
$change_data = '<p><em>foobar</em></p>';
|
||||
$original_data = array(
|
||||
'foo' => 'bar',
|
||||
'404' => 'herp',
|
||||
'foo' => '<p>foobar</p>',
|
||||
'baz' => '<strong>no change</strong>',
|
||||
'404' => '<em>herp</em>',
|
||||
);
|
||||
// Update active storage to have html in config data.
|
||||
$this->config($config_name)->setData($original_data)->save();
|
||||
|
||||
// Change a configuration value in staging.
|
||||
$staging_data = $original_data;
|
||||
$staging_data[$change_key] = $change_data;
|
||||
$staging_data[$add_key] = $add_data;
|
||||
unset($staging_data[$remove_key]);
|
||||
$staging->write($config_name, $staging_data);
|
||||
|
||||
// Load the diff UI and verify that the diff reflects the change.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
$this->assertTitle(format_string('View changes of @config_name | Drupal', array('@config_name' => $config_name)));
|
||||
|
||||
// The following assertions do not use $this::assertEscaped() because
|
||||
// \Drupal\Component\Diff\DiffFormatter adds markup that signifies what has
|
||||
// changed.
|
||||
|
||||
// Changed values are escaped.
|
||||
$this->assertText(Html::escape("foo: '<p><em>foobar</em></p>'"));
|
||||
$this->assertText(Html::escape("foo: '<p>foobar</p>'"));
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
// Added value is escaped.
|
||||
$this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
|
||||
// Deleted value is escaped.
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
|
||||
// Reset data back to original, and remove a key
|
||||
$staging_data = $original_data;
|
||||
unset($staging_data[$remove_key]);
|
||||
|
@ -299,6 +318,11 @@ class ConfigImportUITest extends WebTestBase {
|
|||
|
||||
// Load the diff UI and verify that the diff reflects a removed key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("foo: '<p>foobar</p>'"));
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
// Removed key is escaped.
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
|
||||
// Reset data back to original and add a key
|
||||
$staging_data = $original_data;
|
||||
|
@ -307,6 +331,11 @@ class ConfigImportUITest extends WebTestBase {
|
|||
|
||||
// Load the diff UI and verify that the diff reflects an added key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
// Added key is escaped.
|
||||
$this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,11 +105,13 @@ class ConfigInstallProfileOverrideTest extends WebTestBase {
|
|||
// Test that override of optional configuration which introduces an unmet
|
||||
// dependency does not get created.
|
||||
$this->assertNull($config_test_storage->load('override_unmet'), 'The optional config_test entity with unmet dependencies is not created.');
|
||||
$this->assertNull($config_test_storage->load('completely_new'), 'The completely new optional config_test entity with unmet dependencies is not created.');
|
||||
|
||||
// Installing dblog creates the optional configuration.
|
||||
$this->container->get('module_installer')->install(['dblog']);
|
||||
$this->rebuildContainer();
|
||||
$this->assertEqual($config_test_storage->load('override_unmet')->label(), 'Override', 'The optional config_test entity is overridden by the profile optional configuration and is installed when its dependencies are met.');
|
||||
$this->assertEqual($config_test_storage->load('completely_new')->label(), 'Completely new optional configuration', 'The optional config_test entity is provided by the profile optional configuration and is installed when its dependencies are met.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\config\Tests\LanguageNegotiationFormOverrideTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\config\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Tests language-negotiation overrides are not on language-negotiation form.
|
||||
*
|
||||
* @group config
|
||||
* @see \Drupal\Core\Form\ConfigFormBase
|
||||
*/
|
||||
class LanguageNegotiationFormOverrideTest extends WebTestBase {
|
||||
|
||||
public static $modules = array('language', 'locale');
|
||||
|
||||
/**
|
||||
* Tests that overrides do not affect language-negotiation form values.
|
||||
*/
|
||||
public function testFormWithOverride() {
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$overridden_value_en = 'whatever';
|
||||
$overridden_value_es = 'loquesea';
|
||||
|
||||
// Set up an override.
|
||||
$settings['config']['language.negotiation']['url']['prefixes'] = (object) array(
|
||||
'value' => array('en' => $overridden_value_en, 'es' => $overridden_value_es),
|
||||
'required' => TRUE,
|
||||
);
|
||||
$this->writeSettings($settings);
|
||||
|
||||
// Add predefined language.
|
||||
$edit = array(
|
||||
'predefined_langcode' => 'es',
|
||||
);
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
|
||||
// Overridden string for language-negotiation should not exist in the form.
|
||||
$this->drupalGet('admin/config/regional/language/detection/url');
|
||||
|
||||
// The language-negotiation form should be found.
|
||||
$this->assertText('Path prefix configuration', 'Language-negotiation form found for English.');
|
||||
|
||||
// The English override should not be found.
|
||||
$this->assertNoFieldByName('prefix[en]', $overridden_value_en, 'Language-negotiation config override not found in English.');
|
||||
|
||||
// Now check the Spanish version of the page for the same thing.
|
||||
$this->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url');
|
||||
|
||||
// The language-negotiation form should be found.
|
||||
$this->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
|
||||
|
||||
// The Spanish override should not be found.
|
||||
$this->assertNoFieldByName('prefix[es]', $overridden_value_es, 'Language-negotiation config override not found in Spanish.');
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -30,7 +30,7 @@ class ConfigTestListBuilder extends ConfigEntityListBuilder {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
$row['label'] = $this->getLabel($entity);
|
||||
$row['label'] = $entity->label();
|
||||
$row['id'] = $entity->id();
|
||||
return $row + parent::buildRow($entity);
|
||||
}
|
||||
|
|
Reference in a new issue