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

@ -12,38 +12,38 @@ use Drupal\Core\Url;
*/
function toolbar_test_toolbar() {
$items['testing'] = array(
$items['testing'] = [
'#type' => 'toolbar_item',
'tab' => array(
'tab' => [
'#type' => 'link',
'#title' => t('Test tab'),
'#url' => Url::fromRoute('<front>'),
'#options' => array(
'attributes' => array(
'#options' => [
'attributes' => [
'id' => 'toolbar-tab-testing',
'title' => t('Test tab'),
),
),
),
'tray' => array(
],
],
],
'tray' => [
'#heading' => t('Test tray'),
'#wrapper_attributes' => array(
'#wrapper_attributes' => [
'id' => 'toolbar-tray-testing',
),
'content' => array(
],
'content' => [
'#theme' => 'item_list',
'#items' => array(
\Drupal::l(t('link 1'), new Url('<front>', [], array('attributes' => array('title' => 'Test link 1 title')))),
\Drupal::l(t('link 2'), new Url('<front>', [], array('attributes' => array('title' => 'Test link 2 title')))),
\Drupal::l(t('link 3'), new Url('<front>', [], array('attributes' => array('title' => 'Test link 3 title')))),
),
'#attributes' => array(
'class' => array('toolbar-menu'),
),
),
),
'#items' => [
\Drupal::l(t('link 1'), new Url('<front>', [], ['attributes' => ['title' => 'Test link 1 title']])),
\Drupal::l(t('link 2'), new Url('<front>', [], ['attributes' => ['title' => 'Test link 2 title']])),
\Drupal::l(t('link 3'), new Url('<front>', [], ['attributes' => ['title' => 'Test link 3 title']])),
],
'#attributes' => [
'class' => ['toolbar-menu'],
],
],
],
'#weight' => 50,
);
];
return $items;
}

View file

@ -0,0 +1,59 @@
<?php
namespace Drupal\Tests\toolbar\Functional;
use Drupal\Tests\BrowserTestBase;
/**
* Tests the implementation of hook_toolbar() by a module.
*
* @group toolbar
*/
class ToolbarHookToolbarTest extends BrowserTestBase {
/**
* A user with permission to access the administrative toolbar.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['toolbar', 'toolbar_test', 'test_page_test'];
protected function setUp() {
parent::setUp();
// Create an administrative user and log it in.
$this->adminUser = $this->drupalCreateUser(['access toolbar']);
$this->drupalLogin($this->adminUser);
}
/**
* Tests for a tab and tray provided by a module implementing hook_toolbar().
*/
public function testHookToolbar() {
$this->drupalGet('test-page');
$this->assertResponse(200);
// Assert that the toolbar is present in the HTML.
$this->assertRaw('id="toolbar-administration"');
// Assert that the tab registered by toolbar_test is present.
$this->assertRaw('id="toolbar-tab-testing"');
// Assert that the tab item descriptions are present.
$this->assertRaw('title="Test tab"');
// Assert that the tray registered by toolbar_test is present.
$this->assertRaw('id="toolbar-tray-testing"');
// Assert that tray item descriptions are present.
$this->assertRaw('title="Test link 1 title"');
}
}