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

@ -0,0 +1,7 @@
name: 'Help Page Test'
type: module
description: 'Module to test the help page.'
package: Testing
version: VERSION
core: 8.x
hidden: true

View file

@ -0,0 +1,27 @@
<?php
/**
* @file
* Help Page Test module to test the help page.
*/
use \Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function help_page_test_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.help_page_test':
// Make the help text conform to core standards. See
// \Drupal\system\Tests\Module\InstallUninstallTest::assertHelp().
return t('Read the <a href=":url">online documentation for the Help Page Test module</a>.', [':url' => 'http://www.example.com']);
case 'help_page_test.has_help':
return t('I have help!');
}
// Ensure that hook_help() can return an empty string and not cause the block
// to display.
return '';
}

View file

@ -0,0 +1,13 @@
help_page_test.has_help:
path: '/help_page_test/has_help'
defaults:
_controller: '\Drupal\help_page_test\HelpPageTestController::hasHelp'
requirements:
_access: 'TRUE'
help_page_test.no_help:
path: '/help_page_test/no_help'
defaults:
_controller: '\Drupal\help_page_test\HelpPageTestController::noHelp'
requirements:
_access: 'TRUE'

View file

@ -0,0 +1,30 @@
<?php
namespace Drupal\help_page_test;
/**
* Provides controllers for testing the help block.
*/
class HelpPageTestController {
/**
* Provides a route with help.
*
* @return array
* A render array.
*/
public function hasHelp() {
return ['#markup' => 'A route with help.'];
}
/**
* Provides a route with no help.
*
* @return array
* A render array.
*/
public function noHelp() {
return ['#markup' => 'A route without help.'];
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace Drupal\help_page_test\Plugin\HelpSection;
use Drupal\help\Plugin\HelpSection\HelpSectionPluginBase;
/**
* Provides an empty section for the help page, for testing.
*
* @HelpSection(
* id = "empty_section",
* title = @Translation("Empty section"),
* description = @Translation("This description should appear."),
* )
*/
class EmptyHelpSection extends HelpSectionPluginBase {
/**
* {@inheritdoc}
*/
public function listTopics() {
return [];
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\help_test\SupernovaGenerator.
*/
namespace Drupal\help_test;
use Drupal\Core\Routing\UrlGeneratorInterface;

View file

@ -0,0 +1,52 @@
<?php
namespace Drupal\Tests\help\Kernel;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Routing\RouteMatch;
use Drupal\help_test\SupernovaGenerator;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the empty HTML page.
*
* @group help
*/
class HelpEmptyPageTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['system', 'help_test', 'user'];
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container) {
parent::register($container);
$container->set('url_generator', new SupernovaGenerator());
}
/**
* Ensures that no URL generator is called on a page without hook_help().
*/
public function testEmptyHookHelp() {
$all_modules = system_rebuild_module_data();
$all_modules = array_filter($all_modules, function ($module) {
// Filter contrib, hidden, already enabled modules and modules in the
// Testing package.
if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
return FALSE;
}
return TRUE;
});
$this->enableModules(array_keys($all_modules));
$this->installEntitySchema('menu_link_content');
$route = \Drupal::service('router.route_provider')->getRouteByName('<front>');
\Drupal::service('module_handler')->invokeAll('help', ['<front>', new RouteMatch('<front>', $route)]);
}
}