summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-05-15 03:47:54 (GMT)
committerAlex Pott2016-05-15 03:47:54 (GMT)
commitac4b5c7f0721aff251366f4aa2e293618dce1f98 (patch)
treeb3657ec63166408386a108ebc8719fc822888930
parent1d8476572e8c24f328688072ff480c07f787579a (diff)
Issue #2723585 by danielmrichards, valthebald, John Cook: Remove entity_load* usage for view entity type
-rw-r--r--core/modules/aggregator/src/Tests/AggregatorRenderingTest.php3
-rw-r--r--core/modules/config/src/Tests/ConfigOtherModuleTest.php11
-rw-r--r--core/modules/shortcut/src/Tests/ShortcutLinksTest.php3
-rw-r--r--core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php3
-rw-r--r--core/modules/views/src/Tests/Plugin/ExposedFormTest.php3
-rw-r--r--core/modules/views/src/Tests/Plugin/StyleTableTest.php6
-rw-r--r--core/modules/views/tests/src/Kernel/ViewExecutableTest.php2
-rw-r--r--core/modules/views/tests/src/Kernel/ViewStorageTest.php6
-rw-r--r--core/modules/views_ui/src/Tests/DisplayTest.php2
9 files changed, 25 insertions, 14 deletions
diff --git a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
index dff5c9f..888f1da 100644
--- a/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
+++ b/core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
@@ -3,6 +3,7 @@
namespace Drupal\aggregator\Tests;
use Drupal\Component\Utility\SafeMarkup;
+use Drupal\views\Entity\View;
/**
* Tests display of aggregator items on the page.
@@ -90,7 +91,7 @@ class AggregatorRenderingTest extends AggregatorTestBase {
public function testFeedPage() {
// Increase the number of items published in the rss.xml feed so we have
// enough articles to test paging.
- $view = entity_load('view', 'frontpage');
+ $view = View::load('frontpage');
$display = &$view->getDisplay('feed_1');
$display['display_options']['pager']['options']['items_per_page'] = 30;
$view->save();
diff --git a/core/modules/config/src/Tests/ConfigOtherModuleTest.php b/core/modules/config/src/Tests/ConfigOtherModuleTest.php
index 8ad1e19..56c4b31 100644
--- a/core/modules/config/src/Tests/ConfigOtherModuleTest.php
+++ b/core/modules/config/src/Tests/ConfigOtherModuleTest.php
@@ -85,11 +85,16 @@ class ConfigOtherModuleTest extends WebTestBase {
*/
public function testUninstall() {
$this->installModule('views');
- $this->assertTrue(entity_load('view', 'frontpage', TRUE) === NULL, 'After installing Views, frontpage view which is dependant on the Node and Views modules does not exist.');
+ $storage = $this->container->get('entity_type.manager')->getStorage('view');
+ $storage->resetCache(array('frontpage'));
+ $this->assertTrue($storage->load('frontpage') === NULL, 'After installing Views, frontpage view which is dependant on the Node and Views modules does not exist.');
$this->installModule('node');
- $this->assertTrue(entity_load('view', 'frontpage', TRUE) !== NULL, 'After installing Node, frontpage view which is dependant on the Node and Views modules exists.');
+ $storage->resetCache(array('frontpage'));
+ $this->assertTrue($storage->load('frontpage') !== NULL, 'After installing Node, frontpage view which is dependant on the Node and Views modules exists.');
$this->uninstallModule('node');
- $this->assertTrue(entity_load('view', 'frontpage', TRUE) === NULL, 'After uninstalling Node, frontpage view which is dependant on the Node and Views modules does not exist.');
+ $storage = $this->container->get('entity_type.manager')->getStorage('view');
+ $storage->resetCache(array('frontpage'));
+ $this->assertTrue($storage->load('frontpage') === NULL, 'After uninstalling Node, frontpage view which is dependant on the Node and Views modules does not exist.');
}
/**
diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index 3922d1f..c6efe41 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -6,6 +6,7 @@ use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Url;
use Drupal\shortcut\Entity\Shortcut;
use Drupal\shortcut\Entity\ShortcutSet;
+use Drupal\views\Entity\View;
/**
* Create, view, edit, delete, and change shortcut links.
@@ -233,7 +234,7 @@ class ShortcutLinksTest extends ShortcutTestBase {
$this->drupalGet('admin/content');
$this->assertResponse(200);
// Disable the view.
- entity_load('view', 'content')->disable()->save();
+ View::load('content')->disable()->save();
/** @var \Drupal\Core\Routing\RouteBuilderInterface $router_builder */
$router_builder = \Drupal::service('router.builder');
$router_builder->rebuildIfNeeded();
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
index b37a717..7dff50a 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php
@@ -7,6 +7,7 @@ use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\views\Tests\ViewTestData;
use Drupal\views_ui\Tests\UITestBase;
+use Drupal\views\Entity\View;
/**
* Tests the taxonomy index filter handler UI.
@@ -102,7 +103,7 @@ class TaxonomyIndexTidUiTest extends UITestBase {
// Ensure the autocomplete input element appears when using the 'textfield'
// type.
- $view = entity_load('view', 'test_filter_taxonomy_index_tid');
+ $view = View::load('test_filter_taxonomy_index_tid');
$display =& $view->getDisplay('default');
$display['display_options']['filters']['tid']['type'] = 'textfield';
$view->save();
diff --git a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
index 719d4da..c5cdd08 100644
--- a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
+++ b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php
@@ -8,6 +8,7 @@ use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
+use Drupal\views\Entity\View;
/**
* Tests exposed forms functionality.
@@ -241,7 +242,7 @@ class ExposedFormTest extends ViewTestBase {
* Test the input required exposed form type.
*/
public function testInputRequired() {
- $view = entity_load('view', 'test_exposed_form_buttons');
+ $view = View::load('test_exposed_form_buttons');
$display = &$view->getDisplay('default');
$display['display_options']['exposed_form']['type'] = 'input_required';
$view->save();
diff --git a/core/modules/views/src/Tests/Plugin/StyleTableTest.php b/core/modules/views/src/Tests/Plugin/StyleTableTest.php
index ade5ebe..9a3f25e 100644
--- a/core/modules/views/src/Tests/Plugin/StyleTableTest.php
+++ b/core/modules/views/src/Tests/Plugin/StyleTableTest.php
@@ -2,6 +2,8 @@
namespace Drupal\views\Tests\Plugin;
+use Drupal\views\Entity\View;
+
/**
* Tests the table style views plugin.
*
@@ -44,7 +46,7 @@ class StyleTableTest extends PluginTestBase {
$this->assertEqual(trim((string) $result[0]), 'description-text');
// Remove the caption and ensure the caption is not displayed anymore.
- $view = entity_load('view', 'test_table');
+ $view = View::load('test_table');
$display = &$view->getDisplay('default');
$display['display_options']['style']['options']['caption'] = '';
$view->save();
@@ -88,7 +90,7 @@ class StyleTableTest extends PluginTestBase {
$this->assertTrue(count($result), 'Ensure there is a td with the class views-field-job-1');
// Combine the second job-column with the first one, with ', ' as separator.
- $view = entity_load('view', 'test_table');
+ $view = View::load('test_table');
$display = &$view->getDisplay('default');
$display['display_options']['style']['options']['columns']['job_1'] = 'job';
$display['display_options']['style']['options']['info']['job']['separator'] = ', ';
diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
index 0ca5587..01057b4 100644
--- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
@@ -99,7 +99,7 @@ class ViewExecutableTest extends ViewsKernelTestBase {
public function testFactoryService() {
$factory = $this->container->get('views.executable');
$this->assertTrue($factory instanceof ViewExecutableFactory, 'A ViewExecutableFactory instance was returned from the container.');
- $view = entity_load('view', 'test_executable_displays');
+ $view = View::load('test_executable_displays');
$this->assertTrue($factory->get($view) instanceof ViewExecutable, 'A ViewExecutable instance was returned from the factory.');
}
diff --git a/core/modules/views/tests/src/Kernel/ViewStorageTest.php b/core/modules/views/tests/src/Kernel/ViewStorageTest.php
index 5e999e0..fa264bd 100644
--- a/core/modules/views/tests/src/Kernel/ViewStorageTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewStorageTest.php
@@ -78,7 +78,7 @@ class ViewStorageTest extends ViewsKernelTestBase {
* Tests loading configuration entities.
*/
protected function loadTests() {
- $view = entity_load('view', 'test_view_storage');
+ $view = View::load('test_view_storage');
$data = $this->config('views.view.test_view_storage')->get();
// Confirm that an actual view object is loaded and that it returns all of
@@ -143,7 +143,7 @@ class ViewStorageTest extends ViewsKernelTestBase {
// Check the UUID of the loaded View.
$created->save();
- $created_loaded = entity_load('view', 'test_view_storage_new');
+ $created_loaded = View::load('test_view_storage_new');
$this->assertIdentical($created->uuid(), $created_loaded->uuid(), 'The created UUID has been saved correctly.');
}
@@ -152,7 +152,7 @@ class ViewStorageTest extends ViewsKernelTestBase {
*/
protected function displayTests() {
// Check whether a display can be added and saved to a View.
- $view = entity_load('view', 'test_view_storage_new');
+ $view = View::load('test_view_storage_new');
$new_id = $view->addDisplay('page', 'Test', 'test');
$display = $view->get('display');
diff --git a/core/modules/views_ui/src/Tests/DisplayTest.php b/core/modules/views_ui/src/Tests/DisplayTest.php
index 39b85e4..7f5f125 100644
--- a/core/modules/views_ui/src/Tests/DisplayTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayTest.php
@@ -191,7 +191,7 @@ class DisplayTest extends UITestBase {
*/
public function testPageContextualLinks() {
$this->drupalLogin($this->drupalCreateUser(array('administer views', 'access contextual links')));
- $view = entity_load('view', 'test_display');
+ $view = View::load('test_display');
$view->enable()->save();
$this->container->get('router.builder')->rebuildIfNeeded();