From bade91289f43e2d77e601120e2f716b4ecd41523 Mon Sep 17 00:00:00 2001 From: Kristiaan Van den Eynde Date: Mon, 29 May 2017 14:50:26 +0200 Subject: [PATCH] interdiff --- .../src/Kernel/CommentDefaultFormatterCacheTagsTest.php | 10 ---------- .../views/tests/src/Kernel/Handler/FieldFieldTest.php | 3 ++- .../tests/src/Kernel/Handler/FieldRenderedEntityTest.php | 12 ++++++++---- .../views/tests/src/Kernel/Plugin/RowRenderCacheTest.php | 3 +-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php b/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php index bdea71d..3dc02e8 100644 --- a/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php +++ b/core/modules/comment/tests/src/Kernel/CommentDefaultFormatterCacheTagsTest.php @@ -81,11 +81,6 @@ public function testCacheTags() { $expected_cache_tags = [ 'entity_test_view', 'entity_test:' . $commented_entity->id(), - 'config:core.entity_form_display.comment.comment.default', - 'config:field.field.comment.comment.comment_body', - 'config:field.field.entity_test.entity_test.comment', - 'config:field.storage.comment.comment_body', - 'config:user.settings', ]; sort($expected_cache_tags); $this->assertEqual($build['#cache']['tags'], $expected_cache_tags); @@ -129,11 +124,6 @@ public function testCacheTags() { 'config:filter.format.plain_text', 'user_view', 'user:2', - 'config:core.entity_form_display.comment.comment.default', - 'config:field.field.comment.comment.comment_body', - 'config:field.field.entity_test.entity_test.comment', - 'config:field.storage.comment.comment_body', - 'config:user.settings', ]; sort($expected_cache_tags); $this->assertEqual($build['#cache']['tags'], $expected_cache_tags); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php index 1d304f5..f361a6d 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldFieldTest.php @@ -66,6 +66,7 @@ protected function setUp($import_test_views = TRUE) { // First setup the needed entity types before installing the views. parent::setUp(FALSE); + $this->installConfig('user'); $this->installEntitySchema('user'); $this->installEntitySchema('entity_test'); $this->installEntitySchema('entity_test_rev'); @@ -73,7 +74,7 @@ protected function setUp($import_test_views = TRUE) { ViewTestData::createTestViews(get_class($this), ['views_test_config']); // Bypass any field access. - $this->adminUser = User::create(['name' => $this->randomString()]); + $this->adminUser = User::create(['name' => $this->randomString(), 'roles' => ['administrator']]); $this->adminUser->save(); $this->container->get('current_user')->setAccount($this->adminUser); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php index 02419f4..c70941e 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldRenderedEntityTest.php @@ -6,6 +6,7 @@ use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\user\Entity\Role; use Drupal\user\Entity\User; use Drupal\views\Entity\View; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; @@ -87,10 +88,17 @@ protected function setUpFixtures() { ])->save(); } + Role::create([ + 'id' => 'test_role', + 'label' => 'Can view test entities', + 'permissions' => ['view test entity'], + ])->save(); $this->user = User::create([ 'name' => 'test user', + 'roles' => ['test_role'], ]); $this->user->save(); + \Drupal::currentUser()->setAccount($this->user); parent::setUpFixtures(); } @@ -99,8 +107,6 @@ protected function setUpFixtures() { * Tests the default rendered entity output. */ public function testRenderedEntityWithoutField() { - \Drupal::currentUser()->setAccount($this->user); - EntityViewDisplay::load('entity_test.entity_test.foobar') ->removeComponent('test_field') ->save(); @@ -167,8 +173,6 @@ protected function assertConfigDependencies(View $storage) { * Tests the rendered entity output with the test field configured to show. */ public function testRenderedEntityWithField() { - \Drupal::currentUser()->setAccount($this->user); - // Show the test_field on the entity_test.entity_test.foobar view display. EntityViewDisplay::load('entity_test.entity_test.foobar')->setComponent('test_field', ['type' => 'string', 'label' => 'above'])->save(); diff --git a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php index 223963e..6be14a4 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php @@ -188,11 +188,10 @@ protected function doTestRenderedOutput(AccountInterface $account, $check_cache if ($check_cache) { $keys = $cache_plugin->getRowCacheKeys($view->result[$index]); - $user_context = !$account->hasPermission('edit any test content') ? 'user' : 'user.permissions'; $cache = [ '#cache' => [ 'keys' => $keys, - 'contexts' => ['languages:language_interface', 'theme', $user_context], + 'contexts' => ['languages:language_interface', 'theme', 'user.permissions'], ], ]; $element = $render_cache->get($cache); -- 2.8.1