protected function BambooTwigSecurityTest::setUp in Bamboo Twig 8.5
Same name in this branch
- 8.5 tests/src/Functional/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigSecurityTest::setUp()
- 8.5 tests/src/Kernel/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Kernel\BambooTwigSecurityTest::setUp()
Same name and namespace in other branches
- 8.4 tests/src/Kernel/BambooTwigSecurityTest.php \Drupal\Tests\bamboo_twig\Kernel\BambooTwigSecurityTest::setUp()
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ BambooTwigSecurityTest.php, line 37
Class
- BambooTwigSecurityTest
- Tests Security twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('user');
$this
->installSchema('system', [
'sequences',
]);
/** @var \Drupal\Core\Entity\EntityTypeManager $entityTypeManager */
$this->entityTypeManager = $this->container
->get('entity_type.manager');
/** @var \Drupal\bamboo_twig_security\TwigExtension\Security $securityExtension */
$this->securityExtension = $this->container
->get('bamboo_twig_security.twig.security');
// Create admin user.
$adminUser = $this->entityTypeManager
->getStorage('user')
->create([
'uid' => 1,
'mail' => 'admin',
'name' => 'admin',
'status' => 1,
]);
$adminUser
->addRole('administrator');
$adminUser
->save();
// Create anonymous user.
$adminUser = $this->entityTypeManager
->getStorage('user')
->create([
'uid' => 2,
'mail' => 'anonymous',
'name' => 'anonymous',
'status' => 1,
]);
$adminUser
->save();
}