Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes

This commit is contained in:
Pantheon Automation 2016-01-06 16:31:26 -08:00 committed by Greg Anderson
parent 1a0e9d9fac
commit a6b049dd05
538 changed files with 5247 additions and 1594 deletions

View file

@ -37,7 +37,7 @@ class ThemeController extends ControllerBase {
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ThemeHandlerInterface $theme_handler,ConfigFactoryInterface $config_factory) {
public function __construct(ThemeHandlerInterface $theme_handler, ConfigFactoryInterface $config_factory) {
$this->themeHandler = $theme_handler;
$this->configFactory = $config_factory;
}

View file

@ -148,7 +148,7 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase {
);
// List the dependent entities.
$this->addDependencyListsToForm($form, 'module', $this->modules ,$this->configManager, $this->entityManager);
$this->addDependencyListsToForm($form, 'module', $this->modules , $this->configManager, $this->entityManager);
return parent::buildForm($form, $form_state);
}

View file

@ -178,17 +178,11 @@ class ThemeSettingsForm extends ConfigFormBase {
}
// Logo settings, only available when file.module is enabled.
if ((!$theme) || in_array('logo', $features) && $this->moduleHandler->moduleExists('file')) {
if ((!$theme || in_array('logo', $features)) && $this->moduleHandler->moduleExists('file')) {
$form['logo'] = array(
'#type' => 'details',
'#title' => t('Logo image settings'),
'#open' => TRUE,
'#states' => array(
// Hide the logo image settings fieldset when logo display is disabled.
'invisible' => array(
'input[name="toggle_logo"]' => array('checked' => FALSE),
),
),
);
$form['logo']['default_logo'] = array(
'#type' => 'checkbox',
@ -430,7 +424,6 @@ class ThemeSettingsForm extends ConfigFormBase {
$filename = file_unmanaged_copy($values['logo_upload']->getFileUri());
$values['default_logo'] = 0;
$values['logo_path'] = $filename;
$values['toggle_logo'] = 1;
}
if (!empty($values['favicon_upload'])) {
$filename = file_unmanaged_copy($values['favicon_upload']->getFileUri());

View file

@ -17,7 +17,7 @@ class AjaxFormPageCacheTest extends AjaxTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$config = $this->config('system.performance');

View file

@ -91,7 +91,7 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->themeHandler = $this->container->get('theme_handler');

View file

@ -7,6 +7,7 @@
namespace Drupal\system\Tests\Cache;
use Drupal\Core\Cache\Apcu4Backend;
use Drupal\Core\Cache\ApcuBackend;
/**
@ -21,7 +22,7 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
* Get a list of failed requirements.
*
* This specifically bypasses checkRequirements because it fails tests. PHP 7
* does not have APC and simpletest does not have a explicit "skip"
* does not have APCu and simpletest does not have a explicit "skip"
* functionality so to emulate it we override all test methods and explicitly
* pass when requirements are not met.
*
@ -29,13 +30,10 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
*/
protected function getRequirements() {
$requirements = [];
if (!extension_loaded('apc')) {
$requirements[] = 'APC extension not found.';
if (!extension_loaded('apcu')) {
$requirements[] = 'APCu extension not found.';
}
else {
if (version_compare(phpversion('apc'), '3.1.1', '<')) {
$requirements[] = 'APC extension must be newer than 3.1.1 for APCIterator support.';
}
if (PHP_SAPI === 'cli' && !ini_get('apc.enable_cli')) {
$requirements[] = 'apc.enable_cli must be enabled to run this test.';
}
@ -66,7 +64,12 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
* {@inheritdoc}
*/
protected function createCacheBackend($bin) {
return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
if (version_compare(phpversion('apcu'), '5.0.0', '>=')) {
return new ApcuBackend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
}
else {
return new Apcu4Backend($bin, $this->databasePrefix, \Drupal::service('cache_tags.invalidator.checksum'));
}
}
/**
@ -91,7 +94,15 @@ class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
// Make sure entries are permanent (i.e. no TTL).
$backend = $this->getCacheBackend($this->getTestBin());
$key = $backend->getApcuKey('TEST8');
foreach (new \APCIterator('user', '/^' . $key . '/') as $item) {
if (class_exists('\APCUIterator')) {
$iterator = new \APCUIterator('/^' . $key . '/');
}
else {
$iterator = new \APCIterator('user', '/^' . $key . '/');
}
foreach ($iterator as $item) {
$this->assertEqual(0, $item['ttl']);
$found = TRUE;
}

View file

@ -268,7 +268,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
'test3' => '',
'test4' => 12.64,
'test5' => FALSE,
'test6' => array(1,2,3),
'test6' => array(1, 2, 3),
);
// Create cache entries.

View file

@ -66,7 +66,7 @@ class ConnectionUnitTest extends KernelTestBase {
/**
* Returns the connection ID of the current test connection.
*
* @return integer
* @return int
*/
protected function getConnectionID() {
return (int) Database::getConnection($this->target, $this->key)->query('SELECT CONNECTION_ID()')->fetchField();
@ -75,7 +75,7 @@ class ConnectionUnitTest extends KernelTestBase {
/**
* Asserts that a connection ID exists.
*
* @param integer $id
* @param int $id
* The connection ID to verify.
*/
protected function assertConnection($id) {
@ -86,7 +86,7 @@ class ConnectionUnitTest extends KernelTestBase {
/**
* Asserts that a connection ID does not exist.
*
* @param integer $id
* @param int $id
* The connection ID to verify.
*/
protected function assertNoConnection($id) {

View file

@ -145,7 +145,7 @@ class InsertTest extends DatabaseTestBase {
// re-ordered.
$query->addExpression('tp.age', 'age');
$query
->fields('tp', array('name','job'))
->fields('tp', array('name', 'job'))
->condition('tp.name', 'Meredith');
// The resulting query should be equivalent to:

View file

@ -644,7 +644,7 @@ class SchemaTest extends KernelTestBase {
*/
function testSchemaChangeField() {
$field_specs = array(
array('type' => 'int', 'size' => 'normal','not null' => FALSE),
array('type' => 'int', 'size' => 'normal', 'not null' => FALSE),
array('type' => 'int', 'size' => 'normal', 'not null' => TRUE, 'initial' => 1, 'default' => 17),
array('type' => 'float', 'size' => 'normal', 'not null' => FALSE),
array('type' => 'float', 'size' => 'normal', 'not null' => TRUE, 'initial' => 1, 'default' => 7.3),

View file

@ -40,7 +40,7 @@ class ContentEntityChangedTest extends EntityUnitTestBase {
protected $mulRevChangedStorage;
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();

View file

@ -27,7 +27,7 @@ class ContentEntityNullStorageTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('system', 'contact', 'user');
public static $modules = array('system', 'contact', 'user');
/**
* Tests using entity query with ContentEntityNullStorage.

View file

@ -7,6 +7,7 @@
namespace Drupal\system\Tests\Entity;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessibleInterface;
use Drupal\Core\Entity\EntityAccessControlHandler;
@ -155,6 +156,10 @@ class EntityAccessControlHandlerTest extends EntityLanguageTestBase {
// Test hook_entity_create_access() and hook_ENTITY_TYPE_create_access().
$entity->access('create');
$this->assertEqual($state->get('entity_test_entity_create_access'), TRUE);
$this->assertIdentical($state->get('entity_test_entity_create_access_context'), [
'entity_type_id' => 'entity_test',
'langcode' => LanguageInterface::LANGCODE_DEFAULT,
]);
$this->assertEqual($state->get('entity_test_entity_test_create_access'), TRUE);
// Test hook_entity_access() and hook_ENTITY_TYPE_access().

View file

@ -18,7 +18,7 @@ use Drupal\user\UserInterface;
class EntityApiTest extends EntityUnitTestBase {
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();

View file

@ -26,7 +26,7 @@ class EntitySchemaTest extends EntityUnitTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->installSchema('user', array('users_data'));
$this->installSchema('system', array('router'));

View file

@ -44,7 +44,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->entityManager = $this->container->get('entity.manager');
@ -60,7 +60,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
public function testSingleUpdates() {
// Create a test entity.
$user_ids = [mt_rand(), mt_rand()];
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => $user_ids]);
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => $user_ids]);
$entity->save();
// Check that only a single value is stored for 'user_id'.
@ -108,7 +108,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
public function testMultipleUpdates() {
// Create a test entity.
$user_ids = [mt_rand(), mt_rand()];
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => $user_ids]);
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => $user_ids]);
$entity->save();
// Check that only a single value is stored for 'user_id'.
@ -138,7 +138,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
*/
function testStatusReport() {
// Create a test entity.
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => mt_rand()]);
$entity = EntityTest::create(['name' => $this->randomString(), 'user_id' => mt_rand()]);
$entity->save();
// Check that the status report initially displays no error.

View file

@ -30,9 +30,9 @@ class ValidReferenceConstraintValidatorTest extends EntityUnitTestBase {
public static $modules = array('field', 'user');
/**
* @inheritdoc
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->installSchema('user', array('users_data'));
$this->typedData = $this->container->get('typed_data_manager');

View file

@ -63,10 +63,10 @@ class HtaccessUnitTest extends KernelTestBase {
mkdir($stream, 0777, TRUE);
$this->assertTrue(file_save_htaccess($stream));
$content = file_get_contents($stream . '/.htaccess');
$this->assertTrue(strpos($content,"SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006") !== FALSE);
$this->assertTrue(strpos($content, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006") !== FALSE);
$this->assertTrue(strpos($content, "Require all denied") !== FALSE);
$this->assertTrue(strpos($content,"Deny from all") !== FALSE);
$this->assertTrue(strpos($content,"Options -Indexes -ExecCGI -Includes -MultiViews") !== FALSE);
$this->assertTrue(strpos($content, "Deny from all") !== FALSE);
$this->assertTrue(strpos($content, "Options -Indexes -ExecCGI -Includes -MultiViews") !== FALSE);
$this->assertTrue(strpos($content, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003") !== FALSE);
$this->assertFilePermissions($stream . '/.htaccess', 0444);

View file

@ -38,7 +38,7 @@ class TableTest extends KernelTestBase {
*/
function testThemeTableStickyHeaders() {
$header = array('one', 'two', 'three');
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$table = array(
'#type' => 'table',
'#header' => $header,
@ -57,7 +57,7 @@ class TableTest extends KernelTestBase {
*/
function testThemeTableNoStickyHeaders() {
$header = array('one', 'two', 'three');
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$attributes = array();
$caption = NULL;
$colgroups = array();
@ -172,7 +172,7 @@ class TableTest extends KernelTestBase {
*/
public function testThemeTableResponsive() {
$header = array('one', 'two', 'three');
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$table = array(
'#type' => 'table',
'#header' => $header,
@ -187,7 +187,7 @@ class TableTest extends KernelTestBase {
* Tests that the 'responsive-table' class is not applied without headers.
*/
public function testThemeTableNotResponsiveHeaders() {
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$table = array(
'#type' => 'table',
'#rows' => $rows,
@ -202,7 +202,7 @@ class TableTest extends KernelTestBase {
*/
public function testThemeTableNotResponsiveProperty() {
$header = array('one', 'two', 'three');
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$table = array(
'#type' => 'table',
'#header' => $header,
@ -260,7 +260,7 @@ class TableTest extends KernelTestBase {
),
),
);
$rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$table = array(
'#type' => 'table',
'#header' => $header,

View file

@ -189,10 +189,6 @@ class ThemeTest extends WebTestBase {
$this->assertEqual($elements[0]['src'], file_create_url($uploaded_filename));
$this->container->get('theme_handler')->install(array('bartik'));
$this->drupalGet('admin/appearance/settings/bartik');
// The logo field should only be present on the global theme settings form.
$this->assertNoFieldByName('logo_path');
$this->drupalPostForm(NULL, [], t('Save configuration'));
// Ensure only valid themes are listed in the local tasks.
$this->drupalPlaceBlock('local_tasks_block', ['region' => 'header']);
@ -212,6 +208,29 @@ class ThemeTest extends WebTestBase {
$this->assertResponse(200, 'The theme settings form URL for a hidden theme that is the admin theme is available.');
}
/**
* Test the theme settings logo form.
*/
function testThemeSettingsLogo() {
// Visit Bartik's theme settings page to replace the logo.
$this->container->get('theme_handler')->install(['bartik']);
$this->drupalGet('admin/appearance/settings/bartik');
$edit = [
'default_logo' => FALSE,
'logo_path' => 'core/misc/druplicon.png',
];
$this->drupalPostForm('admin/appearance/settings/bartik', $edit, t('Save configuration'));
$this->assertFieldByName('default_logo', FALSE);
$this->assertFieldByName('logo_path', 'core/misc/druplicon.png');
// Make sure the logo and favicon settings are not available when the file
// module is not enabled.
\Drupal::service('module_installer')->uninstall(['file']);
$this->drupalGet('admin/appearance/settings');
$this->assertNoText('Logo image settings');
$this->assertNoText('Shortcut icon settings');
}
/**
* Test the administration theme functionality.
*/

View file

@ -21,7 +21,7 @@ use Drupal\Core\Render\BubbleableMetadata;
class TokenReplaceUnitTest extends TokenReplaceUnitTestBase {
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();

View file

@ -54,7 +54,7 @@ class StableLibraryOverrideTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->themeManager = $this->container->get('theme.manager');

View file

@ -40,7 +40,7 @@ class StableThemeTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->themeHandler = $this->container->get('theme_handler');

View file

@ -40,7 +40,7 @@ class ThemeTest extends WebTestBase {
* Render arrays that use a render element and templates (and hence call
* template_preprocess()) must ensure the attributes at different occasions
* are all merged correctly:
* - $variables['attributes'] as passed in to _theme()
* - $variables['attributes'] as passed in to the theme hook implementation.
* - the render element's #attributes
* - any attributes set in the template's preprocessing function
*/
@ -57,7 +57,7 @@ class ThemeTest extends WebTestBase {
}
/**
* Test that _theme() returns expected data types.
* Test that ThemeManager renders the expected data types.
*/
function testThemeDataTypes() {
// theme_test_false is an implemented theme hook so \Drupal::theme() service

View file

@ -81,7 +81,7 @@ class DbDumpTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
// Determine what database backend is running, and set the skip flag.

View file

@ -31,7 +31,7 @@ class LocalActionsAndTasksConvertedIntoBlocksUpdateTest extends UpdatePathTestBa
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = \Drupal::service('theme_handler');

View file

@ -29,7 +29,7 @@ class SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest extends UpdatePathTes
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
$theme_handler = \Drupal::service('theme_handler');

View file

@ -37,7 +37,7 @@ class UpdateSchemaTest extends WebTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
require_once \Drupal::root() . '/core/includes/update.inc';

View file

@ -1062,10 +1062,13 @@ function system_rebuild_module_data() {
/**
* Returns an array of default theme features.
*
* @see \Drupal\Core\Extension\ThemeHandler::$defaultFeatures
*/
function _system_default_theme_features() {
return array(
'favicon',
'logo',
'node_user_picture',
'comment_user_picture',
'comment_user_verification',
@ -1163,9 +1166,9 @@ function system_default_region($theme) {
* for the user by \Drupal\system\Controller\SystemController::compactPage().
*
* If the user does not have the cookie, the default value is given by the
* system variable 'admin_compact_mode', which itself defaults to FALSE. This
* does not have a user interface to set it: it is a hidden variable which can
* be set in the settings.php file.
* configuration variable 'system.site.admin_compact_mode', which itself
* defaults to FALSE. This does not have a user interface to set it: it is a
* hidden variable which can be set in the settings.php file.
*
* @return bool
* TRUE when in compact mode, FALSE when in expanded mode.

View file

@ -5,8 +5,10 @@
*
* Used for grouped form items. Can also be used as a theme wrapper for any
* renderable element, to surround it with a <div> and HTML attributes.
* See the @link forms_api_reference.html Form API reference @endlink for more
* information on the #theme_wrappers render array property.
* See \Drupal\Core\Render\Element\RenderElement for more
* information on the #theme_wrappers render array property, and
* \Drupal\Core\Render\Element\container for usage of the container render
* element.
*
* Available variables:
* - attributes: HTML attributes for the containing element.

View file

@ -656,6 +656,7 @@ function entity_test_entity_test_access(EntityInterface $entity, $operation, Acc
*/
function entity_test_entity_create_access(AccountInterface $account, $context, $entity_bundle) {
\Drupal::state()->set('entity_test_entity_create_access', TRUE);
\Drupal::state()->set('entity_test_entity_create_access_context', $context);
// No opinion.
return AccessResult::neutral();

View file

@ -17,7 +17,7 @@ use Drupal\Component\Plugin\Derivative\DeriverBase;
class LocalActionTest extends DeriverBase {
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives['example'] = $base_plugin_definition + [

View file

@ -17,7 +17,7 @@ use Drupal\Component\Plugin\Derivative\DeriverBase;
class LocalTaskTestWithUnsafeTitle extends DeriverBase {
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives['unsafe'] = [

View file

@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Request;
class TestTaskWithUserInput extends LocalTaskDefault {
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getTitle(Request $request = NULL) {
return "<script>alert('Welcome to the jungle!')</script>";

View file

@ -24,7 +24,7 @@ class MockMenuBlock {
/**
* The number of menu levels deep to render.
*
* @var integer
* @var int
*/
protected $depth;

View file

@ -88,14 +88,14 @@ function template_preprocess_theme_test_function_suggestions(&$variables) {
}
/**
* Theme function for testing _theme('theme_test_foo').
* Theme function for hook theme_test_foo.
*/
function theme_theme_test_foo($variables) {
return $variables['foo'];
}
/**
* Theme function for testing _theme('theme_test_function_template_override').
* Theme function for hook theme_test_function_template_override.
*/
function theme_theme_test_function_template_override($variables) {
return 'theme_test_function_template_override test failed.';
@ -140,7 +140,8 @@ function template_preprocess_theme_test_render_element(&$variables) {
*
* Theme hooks defining a 'render element' add an internal '#render_children'
* property. When this property is found, drupal_render() avoids calling
* _theme() on the top-level element to prevent infinite recursion.
* the 'theme.manager' service 'render' method on the top-level element to
* prevent infinite recursion.
*
* @param array $variables
* An associative array containing:

View file

@ -27,7 +27,7 @@ class DbDumpCommandTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
// Determine what database backend is running, and set the skip flag.