update drupal

This commit is contained in:
Tessier
2020-10-15 11:59:37 +02:00
parent ebb5db14b5
commit d8b9162932
558 changed files with 5954 additions and 4475 deletions
+1 -1
View File
@@ -1306,7 +1306,7 @@ function system_requirements($phase) {
if ($phase === 'install' || $phase === 'update') {
if (\Drupal::moduleHandler()->moduleExists('pathauto')) {
$info = \Drupal::service('extension.list.module')->getExtensionInfo('pathauto');
if (version_compare($info['version'], '8.x-1.5') <= 0) {
if ($info['version'] && version_compare($info['version'], '8.x-1.5') <= 0) {
$requirements['pathauto_module_incompatibility'] = [
'title' => t('Pathauto'),
'description' => t('The Pathauto module is not compatible with the current version of Drupal core. Update the <a href=":url">Pathauto</a> module to 8.x-1.6 or later.', [
-4
View File
@@ -869,10 +869,6 @@ function system_preprocess_block(&$variables) {
];
}
break;
case 'system_powered_by_block':
$variables['attributes']['role'] = 'complementary';
break;
}
}
+1 -1
View File
@@ -220,7 +220,7 @@ system.site_maintenance_mode:
_form: '\Drupal\system\Form\SiteMaintenanceModeForm'
_title: 'Maintenance mode'
requirements:
_permission: 'administer site configuration'
_permission: 'administer site configuration+administer software updates'
system.run_cron:
path: '/admin/reports/status/run-cron'
@@ -333,6 +333,22 @@ function database_test_schema() {
'primary key' => ['id'],
];
$schema['virtual'] = [
'description' => 'A simple table with reserved name in MySQL 8.',
'fields' => [
'id' => [
'description' => 'Simple unique ID.',
'type' => 'int',
'not null' => TRUE,
],
'function' => [
'description' => 'A column with reserved name in MySQL 8.',
'type' => 'text',
],
],
'primary key' => ['id'],
];
$schema['TEST_UPPERCASE'] = $schema['test'];
return $schema;
@@ -0,0 +1,28 @@
<?php
namespace Drupal\entity_test\Entity;
/**
* Test entity class with no bundle but with label.
*
* @ContentEntityType(
* id = "entity_test_no_bundle_with_label",
* label = @Translation("Entity Test without bundle but with label"),
* base_table = "entity_test_no_bundle_with_label",
* handlers = {
* "views_data" = "Drupal\views\EntityViewsData"
* },
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "revision" = "revision_id",
* },
* admin_permission = "administer entity_test content",
* links = {
* "add-form" = "/entity_test_no_bundle_with_label/add",
* },
* )
*/
class EntityTestNoBundleWithLabel extends EntityTest {
}
@@ -76,7 +76,9 @@ class ErrorTestController extends ControllerBase {
*/
public function triggerPDOException() {
define('SIMPLETEST_COLLECT_ERRORS', FALSE);
$this->database->query('SELECT * FROM bananas_are_awesome');
$this->database->select('bananas_are_awesome', 'b')
->fields('b')
->execute();
}
/**
@@ -17,6 +17,7 @@ function new_dependency_test_update_8001() {
'new_dependency_test.alias_dependency',
'new_dependency_test.alias2',
'new_dependency_test.alias_dependency2',
'new_dependency_test.setter_injection',
];
// Gather the state of the services prior to installing the
@@ -34,3 +34,7 @@ services:
decorates: new_dependency_test.another_service_two
decoration_inner_name: new_dependency_test.foo
arguments: ['@new_dependency_test.foo']
new_dependency_test.setter_injection:
class: Drupal\new_dependency_test\SetterInjection
calls:
- [setter, ['@new_dependency_test_with_service.service']]
@@ -0,0 +1,39 @@
<?php
namespace Drupal\new_dependency_test;
use Drupal\new_dependency_test_with_service\NewService;
/**
* Generic service which uses setter injection.
*/
class SetterInjection {
/**
* The injected service.
*
* @var \Drupal\new_dependency_test_with_service\NewService
*/
protected $service;
/**
* SetterInjection constructor.
*
* @param \Drupal\new_dependency_test_with_service\NewService $service
* The service of the new module.
*/
public function setter(NewService $service) {
$this->service = $service;
}
/**
* Get the simple greeting from the service.
*
* @return string
* The greeting.
*/
public function greet() {
return $this->service->greet();
}
}
@@ -66,11 +66,11 @@ session_test.set_message:
requirements:
_access: 'TRUE'
session_test.set_message_but_dont_save:
path: '/session-test/set-message-but-dont-save'
session_test.set_message_but_do_not_save:
path: '/session-test/set-message-but-do-not-save'
defaults:
_title: 'Set message but do not save session'
_controller: '\Drupal\session_test\Controller\SessionTestController::setMessageButDontSave'
_controller: '\Drupal\session_test\Controller\SessionTestController::setMessageButDoNotSave'
requirements:
_access: 'TRUE'
@@ -124,7 +124,7 @@ class SessionTestController extends ControllerBase {
* @return string
* A notification message.
*/
public function setMessageButDontSave() {
public function setMessageButDoNotSave() {
\Drupal::service('session_handler.write_safe')->setSessionWritable(FALSE);
$this->setMessage();
return ['#markup' => ''];
@@ -221,7 +221,7 @@ class ProcessingTest extends BrowserTestBase {
*/
public function assertBatchMessages($texts, $message) {
$pattern = '|' . implode('.*', $texts) . '|s';
return $this->assertPattern($pattern, $message);
return $this->assertPattern($pattern);
}
/**
@@ -71,7 +71,6 @@ class UrlTest extends BrowserTestBase {
'#url' => Url::fromUri($uri),
];
\Drupal::service('renderer')->renderRoot($link);
$this->pass($title);
$this->assertEqual($expected_cacheability, $link['#cache']);
$this->assertEqual($expected_attachments, $link['#attached']);
}
@@ -30,7 +30,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
// information forward to the actual query on the other side of the
// HTTP request.
$limit = 2;
$count = Database::getConnection()->query('SELECT COUNT(*) FROM {test}')->fetchField();
$count = Database::getConnection()->select('test')->countQuery()->execute()->fetchField();
$correct_number = $limit;
$num_pages = floor($count / $limit);
@@ -64,7 +64,7 @@ class SelectPagerDefaultTest extends DatabaseTestBase {
// information forward to the actual query on the other side of the
// HTTP request.
$limit = 2;
$count = Database::getConnection()->query('SELECT COUNT(*) FROM {test_task}')->fetchField();
$count = Database::getConnection()->select('test_task')->countQuery()->execute()->fetchField();
$correct_number = $limit;
$num_pages = floor($count / $limit);
@@ -227,14 +227,18 @@ trait EntityDefinitionTestTrait {
* @param bool $is_revisionable
* (optional) If the base field should be revisionable or not. Defaults to
* FALSE.
* @param bool $set_label
* @param bool $set_label
* (optional) If the base field should have a label or not. Defaults to
* TRUE.
* @param bool $is_translatable
* (optional) If the base field should be translatable or not. Defaults to
* FALSE.
*/
protected function addBaseField($type = 'string', $entity_type_id = 'entity_test_update', $is_revisionable = FALSE, $set_label = TRUE) {
protected function addBaseField($type = 'string', $entity_type_id = 'entity_test_update', $is_revisionable = FALSE, $set_label = TRUE, $is_translatable = FALSE) {
$definitions['new_base_field'] = BaseFieldDefinition::create($type)
->setName('new_base_field')
->setRevisionable($is_revisionable);
->setRevisionable($is_revisionable)
->setTranslatable($is_translatable);
if ($set_label) {
$definitions['new_base_field']->setLabel(t('A new base field'));
@@ -32,7 +32,6 @@ class ConfigTest extends BrowserTestBase {
// Set the file paths to non-default values.
// The respective directories are created automatically
// upon form submission.
$file_path = $this->publicFilesDirectory;
$fields = [
'file_default_scheme' => 'private',
];
@@ -101,7 +101,8 @@ class StorageTest extends BrowserTestBase {
*/
public function testValidation() {
$this->drupalPostForm('form_test/form-storage', ['title' => '', 'value' => 'value_is_set'], 'Continue submit');
$this->assertPattern('/value_is_set/', 'The input values have been kept.');
// Ensure that the input values have been kept.
$this->assertPattern('/value_is_set/');
}
/**
@@ -188,7 +189,12 @@ class StorageTest extends BrowserTestBase {
// Assert that a watchdog message was logged by
// \Drupal::formBuilder()->setCache().
$status = (bool) Database::getConnection()->queryRange('SELECT 1 FROM {watchdog} WHERE message = :message', 0, 1, [':message' => 'Form build-id mismatch detected while attempting to store a form in the cache.']);
$status = (bool) Database::getConnection()->select('watchdog')
->condition('message', 'Form build-id mismatch detected while attempting to store a form in the cache.')
->range(0, 1)
->countQuery()
->execute()
->fetchField();
$this->assertTrue($status, 'A watchdog message was logged by \Drupal::formBuilder()->setCache');
// Ensure that the form state was not poisoned by the preceding call.
@@ -57,15 +57,12 @@ class HtmlToTextTest extends BrowserTestBase {
$tested_tags = implode(', ', array_unique($matches[1]));
$message .= ' (' . $tested_tags . ')';
$result = MailFormatHelper::htmlToText($html, $allowed_tags);
$pass = $this->assertEqual($result, $text, Html::escape($message));
$this->assertEqual($result, $text, Html::escape($message));
$verbose = 'html = <pre>' . $this->stringToHtml($html)
. '</pre><br />result = <pre>' . $this->stringToHtml($result)
. '</pre><br />expected = <pre>' . $this->stringToHtml($text)
. '</pre>';
$this->verbose($verbose);
if (!$pass) {
$this->pass("Previous test verbose info:<br />$verbose");
}
}
/**
@@ -2,7 +2,6 @@
namespace Drupal\Tests\system\Functional\Menu;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
@@ -61,12 +60,7 @@ class LocalTasksTest extends BrowserTestBase {
foreach ($routes as $index => $route_info) {
list($route_name, $route_parameters) = $route_info;
$expected = Url::fromRoute($route_name, $route_parameters)->toString();
$method = ($elements[$index]->getAttribute('href') == $expected ? 'pass' : 'fail');
$this->{$method}(new FormattableMarkup('Task @number href @value equals @expected.', [
'@number' => $index + 1,
'@value' => $elements[$index]->getAttribute('href'),
'@expected' => $expected,
]));
$this->assertEquals($expected, $elements[$index]->getAttribute('href'), "Task " . ($index + 1) . "number href " . $elements[$index]->getAttribute('href') . " equals $expected.");
}
}
@@ -31,7 +31,7 @@ class InstallTest extends BrowserTestBase {
*/
public function testGetSchemaAtInstallTime() {
// @see module_test_install()
$value = Database::getConnection()->query("SELECT data FROM {module_test}")->fetchField();
$value = Database::getConnection()->select('module_test', 'mt')->fields('mt', ['data'])->execute()->fetchField();
$this->assertIdentical($value, 'varchar');
}
@@ -82,8 +82,8 @@ class InstallTest extends BrowserTestBase {
$this->container->get('module_installer')->install([$module_name]);
$this->fail($message);
}
catch (ExtensionNameLengthException $e) {
$this->pass($message);
catch (\Exception $e) {
$this->assertInstanceOf(ExtensionNameLengthException::class, $e);
}
// Since for the UI, the submit callback uses FALSE, test that too.
@@ -92,8 +92,8 @@ class InstallTest extends BrowserTestBase {
$this->container->get('module_installer')->install([$module_name], FALSE);
$this->fail($message);
}
catch (ExtensionNameLengthException $e) {
$this->pass($message);
catch (\Exception $e) {
$this->assertInstanceOf(ExtensionNameLengthException::class, $e);
}
}
@@ -157,7 +157,7 @@ class UninstallTest extends BrowserTestBase {
$this->fail($message);
}
catch (EntityMalformedException $e) {
$this->pass($message);
// Expected exception; just continue testing.
}
// Even though the module failed to install properly, its configuration
@@ -26,7 +26,7 @@ class UpcastingTest extends BrowserTestBase {
* signature: f($user, $node, $foo) returning either values or labels
* like "user: Dries, node: First post, foo: bar"
*
* The tests shuffle the parameters around an checks if the right thing is
* The test shuffles the parameters around and checks if the right thing is
* happening.
*/
public function testUpcasting() {
@@ -307,7 +307,7 @@ class RouterTest extends BrowserTestBase {
$this->fail('Route was delete on uninstall.');
}
catch (RouteNotFoundException $e) {
$this->pass('Route was delete on uninstall.');
// Expected exception; just continue testing.
}
// Install the module again.
\Drupal::service('module_installer')->install(['router_test']);
@@ -254,10 +254,7 @@ class SessionHttpsTest extends BrowserTestBase {
* has the given insecure and secure session IDs.
*/
protected function assertSessionIds($sid, $assertion_text) {
$args = [
':sid' => Crypt::hashBase64($sid),
];
return $this->assertNotEmpty(\Drupal::database()->query('SELECT timestamp FROM {sessions} WHERE sid = :sid', $args)->fetchField(), $assertion_text);
return $this->assertNotEmpty(\Drupal::database()->select('sessions', 's')->fields('s', ['timestamp'])->condition('sid', Crypt::hashBase64($sid))->execute()->fetchField(), $assertion_text);
}
/**
@@ -213,7 +213,7 @@ class SessionTest extends BrowserTestBase {
$this->assertNull($this->drupalGetHeader('Set-Cookie'), 'New session was not started.');
// Verify that no session is created if drupal_save_session(FALSE) is called.
$this->drupalGet('session-test/set-message-but-dont-save');
$this->drupalGet('session-test/set-message-but-do-not-save');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
@@ -233,8 +233,12 @@ class SessionTest extends BrowserTestBase {
$this->drupalLogin($user);
$connection = Database::getConnection();
$sql = 'SELECT u.access, s.timestamp FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE u.uid = :uid';
$times1 = $connection->query($sql, [':uid' => $user->id()])->fetchObject();
$query = $connection->select('users_field_data', 'u');
$query->innerJoin('sessions', 's', 'u.uid = s.uid');
$query->fields('u', ['access'])
->fields('s', ['timestamp'])
->condition('u.uid', $user->id());
$times1 = $query->execute()->fetchObject();
// Before every request we sleep one second to make sure that if the session
// is saved, its timestamp will change.
@@ -242,21 +246,21 @@ class SessionTest extends BrowserTestBase {
// Modify the session.
sleep(1);
$this->drupalGet('session-test/set/foo');
$times2 = $connection->query($sql, [':uid' => $user->id()])->fetchObject();
$times2 = $query->execute()->fetchObject();
$this->assertEqual($times2->access, $times1->access, 'Users table was not updated.');
$this->assertNotEqual($times2->timestamp, $times1->timestamp, 'Sessions table was updated.');
// Write the same value again, i.e. do not modify the session.
sleep(1);
$this->drupalGet('session-test/set/foo');
$times3 = $connection->query($sql, [':uid' => $user->id()])->fetchObject();
$times3 = $query->execute()->fetchObject();
$this->assertEqual($times3->access, $times1->access, 'Users table was not updated.');
$this->assertEqual($times3->timestamp, $times2->timestamp, 'Sessions table was not updated.');
// Do not change the session.
sleep(1);
$this->drupalGet('');
$times4 = $connection->query($sql, [':uid' => $user->id()])->fetchObject();
$times4 = $query->execute()->fetchObject();
$this->assertEqual($times4->access, $times3->access, 'Users table was not updated.');
$this->assertEqual($times4->timestamp, $times3->timestamp, 'Sessions table was not updated.');
@@ -267,7 +271,7 @@ class SessionTest extends BrowserTestBase {
];
$this->writeSettings($settings);
$this->drupalGet('');
$times5 = $connection->query($sql, [':uid' => $user->id()])->fetchObject();
$times5 = $query->execute()->fetchObject();
$this->assertNotEqual($times5->access, $times4->access, 'Users table was updated.');
$this->assertNotEqual($times5->timestamp, $times4->timestamp, 'Sessions table was updated.');
}
@@ -283,7 +287,12 @@ class SessionTest extends BrowserTestBase {
// Reset the sid in {sessions} to a blank string. This may exist in the
// wild in some cases, although we normally prevent it from happening.
Database::getConnection()->query("UPDATE {sessions} SET sid = '' WHERE uid = :uid", [':uid' => $user->id()]);
Database::getConnection()->update('sessions')
->fields([
'sid' => '',
])
->condition('uid', $user->id())
->execute();
// Send a blank sid in the session cookie, and the session should no longer
// be valid. Closing the curl handler will stop the previous session ID
// from persisting.
@@ -105,7 +105,7 @@ class ErrorHandlerTest extends BrowserTestBase {
];
$error_pdo_exception = [
'%type' => 'DatabaseExceptionWrapper',
'@message' => 'SELECT * FROM bananas_are_awesome',
'@message' => 'SELECT b.* FROM {bananas_are_awesome} b',
'%function' => 'Drupal\error_test\Controller\ErrorTestController->triggerPDOException()',
'%line' => 64,
'%file' => drupal_get_path('module', 'error_test') . '/error_test.module',
@@ -127,7 +127,9 @@ class ErrorHandlerTest extends BrowserTestBase {
// We cannot use assertErrorMessage() since the exact error reported
// varies from database to database. Check that the SQL string is displayed.
$this->assertText($error_pdo_exception['%type'], new FormattableMarkup('Found %type in error page.', $error_pdo_exception));
$this->assertText($error_pdo_exception['@message'], new FormattableMarkup('Found @message in error page.', $error_pdo_exception));
// Assert statement improved since static queries adds table alias in the
// error message.
$this->assertSession()->pageTextContains($error_pdo_exception['@message']);
$error_details = new FormattableMarkup('in %function (line ', $error_pdo_exception);
$this->assertRaw($error_details, new FormattableMarkup("Found '@message' in error page.", ['@message' => $error_details]));
@@ -161,7 +161,6 @@ class SiteMaintenanceTest extends BrowserTestBase {
\Drupal::state()->set('system.maintenance_mode', TRUE);
$formats = ['json', 'xml', 'non-existing'];
foreach ($formats as $format) {
$this->pass('Testing format ' . $format);
$this->drupalGet('<front>', ['query' => ['_format' => $format]]);
$this->assertSession()->statusCodeEquals(503);
$this->assertRaw('Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.');
@@ -55,6 +55,7 @@ class UpdatePathNewDependencyTest extends BrowserTestBase {
$this->assertEquals('Hello', $this->container->get('new_dependency_test.alias')->greet());
$this->assertEquals('Hello World', $this->container->get('new_dependency_test.hard_dependency')->greet());
$this->assertEquals('Hello World', $this->container->get('new_dependency_test.optional_dependency')->greet());
$this->assertEquals('Hello', $this->container->get('new_dependency_test.setter_injection')->greet());
// Tests that existing decorated services work as expected during update.
$this->assertTrue(\Drupal::state()->get('new_dependency_test_update_8001.decorated_service'), 'The new_dependency_test.another_service service is decorated');
@@ -70,6 +71,7 @@ class UpdatePathNewDependencyTest extends BrowserTestBase {
'new_dependency_test.alias_dependency' => FALSE,
'new_dependency_test.alias2' => FALSE,
'new_dependency_test.alias_dependency2' => FALSE,
'new_dependency_test.setter_injection' => FALSE,
], $before_install);
$after_install = \Drupal::state()->get('new_dependency_test_update_8001.has_after_install', []);
@@ -81,6 +83,7 @@ class UpdatePathNewDependencyTest extends BrowserTestBase {
'new_dependency_test.alias_dependency' => TRUE,
'new_dependency_test.alias2' => TRUE,
'new_dependency_test.alias_dependency2' => TRUE,
'new_dependency_test.setter_injection' => TRUE,
], $after_install);
}
@@ -659,17 +659,26 @@ class UpdateScriptTest extends BrowserTestBase {
* Tests maintenance mode link on update.php.
*/
public function testMaintenanceModeLink() {
$admin_user = $this->drupalCreateUser([
$full_admin_user = $this->drupalCreateUser([
'administer software updates',
'access administration pages',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$this->drupalLogin($full_admin_user);
$this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertSession()->statusCodeEquals(200);
$this->clickLink('maintenance mode');
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('Maintenance mode', $this->cssSelect('main h1')[0]->getText());
$this->assertSession()->elementContains('css', 'main h1', 'Maintenance mode');
// Now login as a user with only 'administer software updates' (but not
// 'administer site configuration') permission and try again.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertSession()->statusCodeEquals(200);
$this->clickLink('maintenance mode');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->elementContains('css', 'main h1', 'Maintenance mode');
}
/**
@@ -2,7 +2,6 @@
namespace Drupal\Tests\system\Kernel\Common;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\KernelTests\KernelTestBase;
@@ -69,7 +68,7 @@ class AddFeedTest extends KernelTestBase {
$this->setRawContent($response->getContent());
// Assert that the content contains the RSS links we specified.
foreach ($urls as $description => $feed_info) {
$this->assertPattern($this->urlToRSSLinkPattern($feed_info['url'], $feed_info['title']), new FormattableMarkup('Found correct feed header for %description', ['%description' => $description]));
$this->assertPattern($this->urlToRSSLinkPattern($feed_info['url'], $feed_info['title']));
}
}
@@ -59,7 +59,6 @@ class PageRenderTest extends KernelTestBase {
$this->error($assertion);
}
catch (\LogicException $e) {
$this->pass($assertion);
$this->assertEqual($e->getMessage(), 'Only #attached and #cache may be set in ' . $hook . '().');
}
\Drupal::state()->set('bc_test.' . $hook . '.descendant_attached', FALSE);
@@ -73,7 +72,6 @@ class PageRenderTest extends KernelTestBase {
$this->error($assertion);
}
catch (\LogicException $e) {
$this->pass($assertion);
$this->assertEqual($e->getMessage(), 'Only #attached and #cache may be set in ' . $hook . '().');
}
\Drupal::state()->set($module . '.' . $hook . '.render_array', FALSE);
@@ -96,7 +96,7 @@ class ModuleHandlerTest extends KernelTestBase {
$this->fail('ModuleInstaller::install() throws an exception if dependencies are missing.');
}
catch (MissingDependencyException $e) {
$this->pass('ModuleInstaller::install() throws an exception if dependencies are missing.');
// Expected exception; just continue testing.
}
$this->assertFalse($this->moduleHandler()->moduleExists('color'), 'ModuleInstaller::install() aborts if dependencies are missing.');
@@ -292,7 +292,7 @@ class ModuleHandlerTest extends KernelTestBase {
$this->fail($message);
}
catch (ModuleUninstallValidatorException $e) {
$this->pass(get_class($e) . ': ' . $e->getMessage());
// Expected exception; just continue testing.
}
// Uninstalling help needs entity_test to be un-installable.
@@ -302,7 +302,7 @@ class ModuleHandlerTest extends KernelTestBase {
$this->fail($message);
}
catch (ModuleUninstallValidatorException $e) {
$this->pass(get_class($e) . ': ' . $e->getMessage());
// Expected exception; just continue testing.
}
// Deleting the entity.
@@ -13,7 +13,7 @@ use Drupal\KernelTests\KernelTestBase;
class PagerDeprecationTest extends KernelTestBase {
/**
* @expectedDeprecation pager_find_page is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Pager\RequestPagerInterface->findPage() instead. See https://www.drupal.org/node/2779457
* @expectedDeprecation pager_find_page is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Pager\PagerParametersInterface->findPage() instead. See https://www.drupal.org/node/2779457
*/
public function testFindPage() {
$this->assertInternalType('int', pager_find_page());
@@ -27,7 +27,7 @@ class PagerDeprecationTest extends KernelTestBase {
}
/**
* @expectedDeprecation pager_get_query_parameters is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Pager\RequestPagerInterface->getQueryParameters() instead. See https://www.drupal.org/node/2779457
* @expectedDeprecation pager_get_query_parameters is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Pager\PagerParametersInterface->getQueryParameters() instead. See https://www.drupal.org/node/2779457
*/
public function testGetQueryParameters() {
$this->assertInternalType('array', pager_get_query_parameters());
@@ -241,9 +241,9 @@ class MenuLinkTreeTest extends UnitTestCase {
];
// Multi-level tree.
$multi_level_root_a = MenuLinkMock::create(['id' => 'test.roota', 'route_name' => 'roota', 'title' => 'Root A']);
$multi_level_root_b = MenuLinkMock::create(['id' => 'test.rootb', 'route_name' => 'rootb', 'title' => 'Root B']);
$multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parentc', 'route_name' => 'parentc', 'title' => 'Parent C']);
$multi_level_root_a = MenuLinkMock::create(['id' => 'test.root_a', 'route_name' => 'root_a', 'title' => 'Root A']);
$multi_level_root_b = MenuLinkMock::create(['id' => 'test.root_b', 'route_name' => 'root_b', 'title' => 'Root B']);
$multi_level_parent_c = MenuLinkMock::create(['id' => 'test.parent_c', 'route_name' => 'parent_c', 'title' => 'Parent C']);
$tree = [
new MenuLinkTreeElement($multi_level_root_a, TRUE, 0, FALSE, [
new MenuLinkTreeElement($multi_level_parent_c, TRUE, 0, FALSE, [
@@ -256,13 +256,13 @@ class MenuLinkTreeTest extends UnitTestCase {
];
$tree[0]->subtree[0]->subtree[0]->access = $access;
$expected_build = $base_expected_build;
$expected_build['#items']['test.roota'] = $get_built_element($tree[0]);
$expected_build['#items']['test.roota']['below']['test.parentc'] = $get_built_element($tree[0]->subtree[0]);
$expected_build['#items']['test.root_a'] = $get_built_element($tree[0]);
$expected_build['#items']['test.root_a']['below']['test.parent_c'] = $get_built_element($tree[0]->subtree[0]);
if ($access === NULL || $access->isAllowed()) {
$expected_build['#items']['test.roota']['below']['test.parentc']['below']['test.example1'] = $get_built_element($tree[0]->subtree[0]->subtree[0]);
$expected_build['#items']['test.root_a']['below']['test.parent_c']['below']['test.example1'] = $get_built_element($tree[0]->subtree[0]->subtree[0]);
}
$expected_build['#items']['test.rootb'] = $get_built_element($tree[1]);
$expected_build['#items']['test.rootb']['below']['test.example2'] = $get_built_element($tree[1]->subtree[0]);
$expected_build['#items']['test.root_b'] = $get_built_element($tree[1]);
$expected_build['#items']['test.root_b']['below']['test.example2'] = $get_built_element($tree[1]->subtree[0]);
$expected_build['#cache']['contexts'] = array_merge($expected_build['#cache']['contexts'], $access_cache_contexts, $links[0]->getCacheContexts(), $links[1]->getCacheContexts());
$data[] = [
'description' => "Multi-level tree; access=$i; link=$j.",