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

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\ContextualController.
*/
namespace Drupal\contextual;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Element\ContextualLinks.
*/
namespace Drupal\contextual\Element;
use Drupal\Component\Utility\Html;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Element\ContextualLinksPlaceholder.
*/
namespace Drupal\contextual\Element;
use Drupal\Core\Template\Attribute;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Plugin\views\field\ContextualLinks.
*/
namespace Drupal\contextual\Plugin\views\field;
use Drupal\Component\Serialization\Json;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Tests\ContextualDynamicContextTest.
*/
namespace Drupal\contextual\Tests;
use Drupal\Component\Serialization\Json;
@ -105,6 +100,12 @@ class ContextualDynamicContextTest extends WebTestBase {
$this->assertIdentical($json[$ids[2]], '<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/3/edit">Edit</a></li></ul>');
$this->assertIdentical($json[$ids[3]], '');
// Verify that link language is properly handled.
$node3->addTranslation('it')->set('title', $this->randomString())->save();
$id = 'node:node=' . $node3->id() . ':changed=' . $node3->getChangedTime() . '&langcode=it';
$this->drupalGet('node', ['language' => ConfigurableLanguage::createFromLangcode('it')]);
$this->assertContextualLinkPlaceHolder($id);
// Authenticated user: can access contextual links, cannot edit articles.
$this->drupalLogin($this->authenticatedUser);
$this->drupalGet('node');
@ -126,19 +127,13 @@ class ContextualDynamicContextTest extends WebTestBase {
$this->drupalLogin($this->anonymousUser);
$this->drupalGet('node');
for ($i = 0; $i < count($ids); $i++) {
$this->assertContextualLinkPlaceHolder($ids[$i]);
$this->assertNoContextualLinkPlaceHolder($ids[$i]);
}
$this->renderContextualLinks(array(), 'node');
$this->assertResponse(403);
$this->renderContextualLinks($ids, 'node');
$this->assertResponse(403);
// Verify that link language is properly handled.
$node3->addTranslation('it')->set('title', $this->randomString())->save();
$id = 'node:node=' . $node3->id() . ':changed=' . $node3->getChangedTime() . '&langcode=it';
$this->drupalGet('node', ['language' => ConfigurableLanguage::createFromLangcode('it')]);
$this->assertContextualLinkPlaceHolder($id);
// Get a page where contextual links are directly rendered.
$this->drupalGet(Url::fromRoute('menu_test.contextual_test'));
$this->assertEscaped("<script>alert('Welcome to the jungle!')</script>");

View file

@ -1,135 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\contextual\Tests\ContextualUnitTest.
*/
namespace Drupal\contextual\Tests;
use Drupal\simpletest\KernelTestBase;
/**
* Tests all edge cases of converting from #contextual_links to ids and vice
* versa.
*
* @group contextual
*/
class ContextualUnitTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contextual');
/**
* Provides testcases for testContextualLinksToId() and
*/
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(
'node' => '14031991',
),
'metadata' => array('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(
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array('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(
'view' => 'frontpage'
),
'metadata' => array(
'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(
'node' => '14031991',
),
'metadata' => array('langcode' => 'en'),
),
'foo' => array(
'route_parameters' => array(
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array('langcode' => 'en'),
),
'edge' => array(
'route_parameters' => array('20011988'),
'metadata' => array('langcode' => 'en'),
),
),
'id' => 'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en',
);
return $tests;
}
/**
* Tests _contextual_links_to_id().
*/
function testContextualLinksToId() {
$tests = $this->_contextual_links_id_testcases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_links_to_id($test['links']), $test['id']);
}
}
/**
* Tests _contextual_id_to_links().
*/
function testContextualIdToLinks() {
$tests = $this->_contextual_links_id_testcases();
foreach ($tests as $test) {
$this->assertIdentical(_contextual_id_to_links($test['id']), $test['links']);
}
}
}