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

@ -6,6 +6,9 @@
*/
use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
/**
* Load the common translation API.
@ -234,15 +237,20 @@ function locale_translation_batch_fetch_finished($success, $results) {
function locale_translation_http_check($uri) {
$logger = \Drupal::logger('locale');
try {
$response = \Drupal::httpClient()->head($uri);
$actual_uri = NULL;
$response = \Drupal::service('http_client_factory')->fromOptions(['allow_redirects' => [
'on_redirect' => function(RequestInterface $request, ResponseInterface $response, UriInterface $request_uri) use (&$actual_uri) {
$actual_uri = (string) $request_uri;
}
]])->head($uri);
$result = array();
// Return the effective URL if it differs from the requested.
if ($response->getEffectiveUrl() != $uri) {
$result['location'] = $response->getEffectiveUrl();
if ($actual_uri && $actual_uri !== $uri) {
$result['location'] = $actual_uri;
}
$result['last_modified'] = $response->hasHeader('Last-Modified') ? strtotime($response->getHeader('Last-Modified')) : 0;
$result['last_modified'] = $response->hasHeader('Last-Modified') ? strtotime($response->getHeaderLine('Last-Modified')) : 0;
return $result;
}
catch (RequestException $e) {

View file

@ -0,0 +1,15 @@
id: d6_locale_settings
label: Drupal 6 locale configuration
migration_tags:
- Drupal 6
source:
plugin: variable
variables:
- locale_cache_strings
- locale_js_directory
process:
cache_strings: locale_cache_strings
'javascript/directory': locale_js_directory
destination:
plugin: config
config_name: locale.settings

View file

@ -123,6 +123,7 @@ class TranslateEditForm extends TranslateFormBase {
for ($i = 0; $i < $plurals; $i++) {
$form['strings'][$string->lid]['translations'][$i] = array(
'#type' => 'textarea',
// @todo Should use better labels https://www.drupal.org/node/2499639
'#title' => ($i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form')),
'#rows' => $rows,
'#default_value' => isset($translation_array[$i]) ? $translation_array[$i] : '',

View file

@ -99,7 +99,7 @@ class TranslationStatusForm extends FormBase {
),
'status' => array(
'class' => array('description', 'priority-low'),
'data' => drupal_render($locale_translation_update_info),
'data' => $locale_translation_update_info,
),
);
if (!empty($update['not_found'])) {

View file

@ -117,7 +117,7 @@ class LocaleLookup extends CacheCollector {
// for example, strings for admin menu items and settings forms are not
// cached for anonymous users.
$user = \Drupal::currentUser();
$rids = $user ? implode(':', array_keys($user->getRoles())) : '0';
$rids = $user ? implode(':', $user->getRoles()) : '';
$this->cid = "locale:{$this->langcode}:{$this->context}:$rids";
// Getting the roles from the current user might have resulted in t()

View file

@ -190,9 +190,7 @@ abstract class StringBase implements StringInterface {
$storage->save($this);
}
else {
throw new StringStorageException(SafeMarkup::format('The string cannot be saved because its not bound to a storage: @string', array(
'@string' => $this->getString(),
)));
throw new StringStorageException('The string cannot be saved because its not bound to a storage: ' . $this->getString());
}
return $this;
}
@ -206,9 +204,7 @@ abstract class StringBase implements StringInterface {
$storage->delete($this);
}
else {
throw new StringStorageException(SafeMarkup::format('The string cannot be deleted because its not bound to a storage: @string', array(
'@string' => $this->getString(),
)));
throw new StringStorageException('The string cannot be deleted because its not bound to a storage: ' . $this->getString());
}
}
return $this;

View file

@ -199,9 +199,7 @@ class StringDatabaseStorage implements StringStorageInterface {
}
}
else {
throw new StringStorageException(format_string('The string cannot be deleted because it lacks some key fields: @string', array(
'@string' => $string->getString(),
)));
throw new StringStorageException('The string cannot be deleted because it lacks some key fields: ' . $string->getString());
}
return $this;
}
@ -483,9 +481,7 @@ class StringDatabaseStorage implements StringStorageInterface {
->execute();
}
else {
throw new StringStorageException(format_string('The string cannot be saved: @string', array(
'@string' => $string->getString(),
)));
throw new StringStorageException('The string cannot be saved: ' . $string->getString());
}
}
@ -516,9 +512,7 @@ class StringDatabaseStorage implements StringStorageInterface {
->execute();
}
else {
throw new StringStorageException(format_string('The string cannot be updated: @string', array(
'@string' => $string->getString(),
)));
throw new StringStorageException('The string cannot be updated: ' . $string->getString());
}
}

View file

@ -125,7 +125,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
$this->assertFalse($string, 'Configuration strings have been created upon installation.');
// Enable the image module.
$this->drupalPostForm('admin/modules', array('modules[Field types][image][enable]' => "1"), t('Save configuration'));
$this->drupalPostForm('admin/modules', array('modules[Field types][image][enable]' => "1"), t('Install'));
$this->rebuildContainer();
$string = $this->storage->findString(array('source' => 'Medium (220×220)', 'context' => '', 'type' => 'configuration'));
@ -204,12 +204,12 @@ class LocaleConfigTranslationTest extends WebTestBase {
public function testOptionalConfiguration() {
$this->assertNodeConfig(FALSE, FALSE);
// Enable the node module.
$this->drupalPostForm('admin/modules', ['modules[Core][node][enable]' => "1"], t('Save configuration'));
$this->drupalPostForm('admin/modules', ['modules[Core][node][enable]' => "1"], t('Install'));
$this->drupalPostForm(NULL, [], t('Continue'));
$this->rebuildContainer();
$this->assertNodeConfig(TRUE, FALSE);
// Enable the views module (which node provides some optional config for).
$this->drupalPostForm('admin/modules', ['modules[Core][views][enable]' => "1"], t('Save configuration'));
$this->drupalPostForm('admin/modules', ['modules[Core][views][enable]' => "1"], t('Install'));
$this->rebuildContainer();
$this->assertNodeConfig(TRUE, TRUE);
}

View file

@ -42,7 +42,7 @@ class LocaleLocaleLookupTest extends WebTestBase {
*/
public function testCircularDependency() {
// Ensure that we can enable early_translation_test on a non-english site.
$this->drupalPostForm('admin/modules', array('modules[Testing][early_translation_test][enable]' => TRUE), t('Save configuration'));
$this->drupalPostForm('admin/modules', array('modules[Testing][early_translation_test][enable]' => TRUE), t('Install'));
$this->assertResponse(200);
}

View file

@ -315,7 +315,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
$edit = array(
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
);
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->drupalPostForm('admin/modules', $edit, t('Install'));
// Check if translations have been imported.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.',
@ -350,7 +350,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
$edit = array(
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
);
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->drupalPostForm('admin/modules', $edit, t('Install'));
// Check if there is no Dutch translation yet.
$this->assertTranslation('Extraday', '', 'nl');
@ -394,7 +394,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
$edit = array(
'modules[Testing][locale_test_translate][enable]' => 'locale_test_translate',
);
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->drupalPostForm('admin/modules', $edit, t('Install'));
// Create a custom language with language code 'xx' and a random
// name.

View file

@ -0,0 +1,48 @@
<?php
/**
* @file
* Contains \Drupal\locale\Tests\Migrate\d6\MigrateLocaleConfigsTest.
*/
namespace Drupal\locale\Tests\Migrate\d6;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to locale.settings.yml.
*
* @group locale
*/
class MigrateLocaleConfigsTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('locale', 'language');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->loadDumps(['Variable.php']);
$this->executeMigration('d6_locale_settings');
}
/**
* Tests migration of locale variables to locale.settings.yml.
*/
public function testLocaleSettings() {
$config = $this->config('locale.settings');
$this->assertIdentical(TRUE, $config->get('cache_strings'));
$this->assertIdentical('languages', $config->get('javascript.directory'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'locale.settings', $config->get());
}
}

View file

@ -111,7 +111,7 @@ class LocaleLookupTest extends UnitTestCase {
$this->cache->expects($this->once())
->method('get')
->with('locale:en:irrelevant:0', FALSE);
->with('locale:en:irrelevant:anonymous', FALSE);
$this->storage->expects($this->once())
->method('findTranslation')
@ -183,7 +183,7 @@ class LocaleLookupTest extends UnitTestCase {
$this->cache->expects($this->once())
->method('get')
->with('locale:' . $langcode . ':' . $context . ':0', FALSE);
->with('locale:' . $langcode . ':' . $context . ':anonymous', FALSE);
$locale_lookup = new LocaleLookup($langcode, $context, $this->storage, $this->cache, $this->lock, $this->configFactory, $this->languageManager, $this->requestStack);
$this->assertSame($expected, $locale_lookup->get($string));