Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -0,0 +1,62 @@
<?php
namespace Drupal\Tests\contextual\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\user\Entity\Role;
/**
* Tests the UI for correct contextual links.
*
* @group contextual
*/
class ContextualLinksTest extends JavascriptTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['block', 'contextual'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->placeBlock('system_branding_block', ['id' => 'branding']);
}
/**
* Tests the visibility of contextual links.
*/
public function testContextualLinksVisibility() {
$this->drupalLogin($this->drupalCreateUser([
'access contextual links'
]));
$this->drupalGet('user');
$contextualLinks = $this->assertSession()->waitForElement('css', '.contextual button');
$this->assertEmpty($contextualLinks);
// Ensure visibility remains correct after cached paged load.
$this->drupalGet('user');
$contextualLinks = $this->assertSession()->waitForElement('css', '.contextual button');
$this->assertEmpty($contextualLinks);
// Grant permissions to use contextual links on blocks.
$this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), [
'access contextual links',
'administer blocks',
]);
$this->drupalGet('user');
$contextualLinks = $this->assertSession()->waitForElement('css', '.contextual button');
$this->assertNotEmpty($contextualLinks);
// Ensure visibility remains correct after cached paged load.
$this->drupalGet('user');
$contextualLinks = $this->assertSession()->waitForElement('css', '.contextual button');
$this->assertNotEmpty($contextualLinks);
}
}

View file

@ -17,92 +17,92 @@ class ContextualUnitTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('contextual');
public static $modules = ['contextual'];
/**
* Provides testcases for testContextualLinksToId() and
*/
function _contextual_links_id_testcases() {
public function _contextual_links_id_testcases() {
// Test branch conditions:
// - one group.
// - one dynamic path argument.
// - no metadata.
$tests[] = array(
'links' => array(
'node' => array(
'route_parameters' => array(
$tests[] = [
'links' => [
'node' => [
'route_parameters' => [
'node' => '14031991',
),
'metadata' => array('langcode' => 'en'),
),
),
],
'metadata' => ['langcode' => 'en'],
],
],
'id' => 'node:node=14031991:langcode=en',
);
];
// Test branch conditions:
// - one group.
// - multiple dynamic path arguments.
// - no metadata.
$tests[] = array(
'links' => array(
'foo' => array(
'route_parameters' => array(
$tests[] = [
'links' => [
'foo' => [
'route_parameters' => [
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array('langcode' => 'en'),
),
),
],
'metadata' => ['langcode' => 'en'],
],
],
'id' => 'foo:0=bar&key=baz&1=qux:langcode=en',
);
];
// Test branch conditions:
// - one group.
// - one dynamic path argument.
// - metadata.
$tests[] = array(
'links' => array(
'views_ui_edit' => array(
'route_parameters' => array(
$tests[] = [
'links' => [
'views_ui_edit' => [
'route_parameters' => [
'view' => 'frontpage'
),
'metadata' => array(
],
'metadata' => [
'location' => 'page',
'display' => 'page_1',
'langcode' => 'en',
),
),
),
],
],
],
'id' => 'views_ui_edit:view=frontpage:location=page&display=page_1&langcode=en',
);
];
// Test branch conditions:
// - multiple groups.
// - multiple dynamic path arguments.
$tests[] = array(
'links' => array(
'node' => array(
'route_parameters' => array(
$tests[] = [
'links' => [
'node' => [
'route_parameters' => [
'node' => '14031991',
),
'metadata' => array('langcode' => 'en'),
),
'foo' => array(
'route_parameters' => array(
],
'metadata' => ['langcode' => 'en'],
],
'foo' => [
'route_parameters' => [
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array('langcode' => 'en'),
),
'edge' => array(
'route_parameters' => array('20011988'),
'metadata' => array('langcode' => 'en'),
),
),
],
'metadata' => ['langcode' => 'en'],
],
'edge' => [
'route_parameters' => ['20011988'],
'metadata' => ['langcode' => 'en'],
],
],
'id' => 'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en',
);
];
return $tests;
}
@ -110,7 +110,7 @@ class ContextualUnitTest extends KernelTestBase {
/**
* Tests _contextual_links_to_id().
*/
function testContextualLinksToId() {
public function testContextualLinksToId() {
$tests = $this->_contextual_links_id_testcases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_links_to_id($test['links']), $test['id']);
@ -120,7 +120,7 @@ class ContextualUnitTest extends KernelTestBase {
/**
* Tests _contextual_id_to_links().
*/
function testContextualIdToLinks() {
public function testContextualIdToLinks() {
$tests = $this->_contextual_links_id_testcases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_id_to_links($test['id']), $test['links']);