Skip to content

Commit

Permalink
EWPP-3180: Ensure that user has access to see content in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nagyad committed Mar 20, 2023
1 parent 7a8c871 commit 621c658
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/src/Kernel/ContentLanguageSwitcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Drupal\node\Entity\Node;
use Drupal\Tests\oe_theme\Traits\RequestTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Symfony\Component\DomCrawler\Crawler;

/**
Expand All @@ -16,6 +17,7 @@
class ContentLanguageSwitcherTest extends MultilingualAbstractKernelTestBase {

use RequestTrait;
use UserCreationTrait;

/**
* Modules to enable.
Expand All @@ -34,6 +36,7 @@ protected function setUp(): void {

$this->installEntitySchema('node');
$this->installSchema('node', 'node_access');
$this->container->get('current_user')->setAccount($this->createUser(['access content']));
}

/**
Expand All @@ -43,6 +46,7 @@ public function testLanguageSwitcherRendering(): void {
$node = Node::create([
'title' => 'Hello, world!',
'type' => 'oe_demo_translatable_page',
'status' => 1,
]);
/** @var \Drupal\Core\Entity\EntityInterface $translation */
$node->addTranslation('es', ['title' => '¡Hola mundo!'])->save();
Expand Down

0 comments on commit 621c658

Please sign in to comment.