diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index dff3d53..a970bf6 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -167,7 +167,9 @@ protected function setUp() { } protected function tearDown() { - $this->kernel->shutdown(); + if ($this->kernel instanceof DrupalKernel) { + $this->kernel->shutdown(); + } parent::tearDown(); } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index dcc4953..8c8a2a5 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -165,6 +165,13 @@ public $dieOnFail = FALSE; /** + * The DurpalKernel used in the test. + * + * @var \Drupal\Core\DrupalKernel + */ + protected $kernel; + + /** * The dependency injection container used in the test. * * @var \Symfony\Component\DependencyInjection\ContainerInterface diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php index d75db82..13efa72 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/FormValuesTest.php @@ -53,6 +53,9 @@ function testSimpleAjaxFormValue() { } // Verify that AJAX elements with invalid callbacks return error code 500. + // Ensure the test error log is empty before these tests. + $log_file = DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'; + $this->assertFalse(file_exists($log_file) && file_get_contents($log_file), 'error.log is empty.'); foreach (array('null', 'empty', 'nonexistent') as $key) { $element_name = 'select_' . $key . '_callback'; $edit = array( @@ -61,5 +64,8 @@ function testSimpleAjaxFormValue() { $commands = $this->drupalPostAjaxForm('ajax_forms_test_get_form', $edit, $element_name); $this->assertResponse(500); } + // Delete the test error log to prevent these expected exceptions from being + // interpreted as a test failure. + file_put_contents($log_file, ''); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php index 2639f3b..7d63e2b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php @@ -10,12 +10,12 @@ use Drupal\Core\DrupalKernel; use Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage; use Drupal\Component\PhpStorage\FileReadOnlyStorage; -use Drupal\simpletest\UnitTestBase; +use Drupal\simpletest\DrupalUnitTestBase; /** * Tests compilation of the DIC. */ -class DrupalKernelTest extends UnitTestBase { +class DrupalKernelTest extends DrupalUnitTestBase { public static function getInfo() { return array( @@ -26,16 +26,9 @@ public static function getInfo() { } function setUp() { - parent::setUp(); - global $conf; - $conf['php_storage']['service_container']= array( - 'bin' => 'service_container', - 'class' => 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage', - 'directory' => DRUPAL_ROOT . '/' . $this->public_files_directory . '/php', - 'secret' => drupal_get_hash_salt(), - ); - // Use a non-persistent cache to avoid queries to non-existing tables. - $this->settingsSet('cache', array('default' => 'cache.backend.memory')); + // Only create configuration directories, but skip unit testing DrupalKernel + // and everything else in DrupalUnitTestBase::setUp(). + $this->prepareConfigDirectories(); } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php index 408b243..f83a875 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayFeedTest.php @@ -19,7 +19,7 @@ class DisplayFeedTest extends PluginTestBase { * * @var array */ - public static $testViews = array('test_feed_display'); + public static $testViews = array('test_display_feed'); /** * Modules to enable. @@ -52,7 +52,7 @@ public function testFeedUI() { $this->drupalGet('admin/structure/views'); // Check the attach TO interface. - $this->drupalGet('admin/structure/views/nojs/display/test_feed_display/feed_1/displays'); + $this->drupalGet('admin/structure/views/nojs/display/test_display_feed/feed_1/displays'); // Load all the options of the checkbox. $result = $this->xpath('//div[@id="edit-displays"]/div'); @@ -68,13 +68,13 @@ public function testFeedUI() { $this->assertEqual($options, array('default', 'page'), 'Make sure all displays appears as expected.'); // Post and save this and check the output. - $this->drupalPostForm('admin/structure/views/nojs/display/test_feed_display/feed_1/displays', array('displays[page]' => 'page'), t('Apply')); - $this->drupalGet('admin/structure/views/view/test_feed_display/edit/feed_1'); + $this->drupalPostForm('admin/structure/views/nojs/display/test_display_feed/feed_1/displays', array('displays[page]' => 'page'), t('Apply')); + $this->drupalGet('admin/structure/views/view/test_display_feed/edit/feed_1'); $this->assertFieldByXpath('//*[@id="views-feed-1-displays"]', 'Page'); // Add the default display, so there should now be multiple displays. - $this->drupalPostForm('admin/structure/views/nojs/display/test_feed_display/feed_1/displays', array('displays[default]' => 'default'), t('Apply')); - $this->drupalGet('admin/structure/views/view/test_feed_display/edit/feed_1'); + $this->drupalPostForm('admin/structure/views/nojs/display/test_display_feed/feed_1/displays', array('displays[default]' => 'default'), t('Apply')); + $this->drupalGet('admin/structure/views/view/test_display_feed/edit/feed_1'); $this->assertFieldByXpath('//*[@id="views-feed-1-displays"]', 'Multiple displays'); } @@ -92,14 +92,14 @@ public function testFeedOutput() { $result = $this->xpath('//title'); $this->assertEqual($result[0], $site_name, 'The site title is used for the feed title.'); - $view = $this->container->get('entity.manager')->getStorageController('view')->load('test_feed_display'); + $view = $this->container->get('entity.manager')->getStorageController('view')->load('test_display_feed'); $display = &$view->getDisplay('feed_1'); $display['display_options']['sitename_title'] = 0; $view->save(); $this->drupalGet('test-feed-display.xml'); $result = $this->xpath('//title'); - $this->assertEqual($result[0], 'test_feed_display', 'The display title is used for the feed title.'); + $this->assertEqual($result[0], 'test_display_feed', 'The display title is used for the feed title.'); } } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml similarity index 89% rename from core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml rename to core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml index 1c82fa3..d4ece5d 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_feed_display.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_feed.yml @@ -1,7 +1,7 @@ base_table: node -core: 8.0-dev +core: 8 description: '' -status: '1' +status: true display: default: display_options: @@ -44,7 +44,7 @@ display: provider: views pager: options: - items_per_page: '10' + items_per_page: 10 type: full query: type: views_query @@ -64,11 +64,11 @@ display: provider: views style: type: default - title: test_feed_display + title: test_display_feed display_plugin: default display_title: Master id: default - position: '0' + position: 0 feed_1: display_options: displays: { } @@ -79,19 +79,19 @@ display: type: node_rss style: type: rss - sitename_title: '1' + sitename_title: true display_plugin: feed display_title: Feed id: feed_1 - position: '0' + position: 0 page: display_options: path: test-feed-display display_plugin: page display_title: Page id: page - position: '0' -label: test_feed_display + position: 0 +label: test_display_feed module: views -id: test_feed_display +id: test_display_feed tag: default diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php index b45efe7..960dbc0 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -258,6 +258,10 @@ protected function getDisplayPaths(EntityInterface $view) { $executable = $view->getExecutable(); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { + // DisplayBag may return NULL if a plugin was not found. + if (!isset($display)) { + continue; + } if ($display->hasPath()) { $path = $display->getPath(); if ($view->status() && strpos($path, '%') === FALSE) {