function FieldDropbuttonTest::setUp
Same name in this branch
- 10 core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php \Drupal\Tests\views\Functional\Handler\FieldDropButtonTest::setUp()
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FieldDropbuttonTest.php \Drupal\Tests\views\Kernel\Handler\FieldDropbuttonTest::setUp()
- 9 core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php \Drupal\Tests\views\Functional\Handler\FieldDropButtonTest::setUp()
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldDropbuttonTest.php \Drupal\Tests\views\Kernel\Handler\FieldDropbuttonTest::setUp()
- 8.9.x core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php \Drupal\Tests\views\Functional\Handler\FieldDropButtonTest::setUp()
- 11.x core/modules/views/tests/src/Kernel/Handler/FieldDropbuttonTest.php \Drupal\Tests\views\Kernel\Handler\FieldDropbuttonTest::setUp()
- 11.x core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php \Drupal\Tests\views\Functional\Handler\FieldDropButtonTest::setUp()
Overrides ViewsKernelTestBase::setUp
File
-
core/
modules/ views/ tests/ src/ Kernel/ Handler/ FieldDropbuttonTest.php, line 75
Class
- FieldDropbuttonTest
- Tests the core Drupal\views\Plugin\views\field\Dropbutton handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
protected function setUp($import_test_views = TRUE) : void {
parent::setUp(FALSE);
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installSchema('node', 'node_access');
$this->installConfig('node');
$this->installConfig('filter');
ViewTestData::createTestViews(static::class, [
'views_test_config',
]);
// Create two node types.
$this->createContentType([
'type' => 'foo',
]);
$this->createContentType([
'type' => 'bar',
]);
// Create user 1.
$admin = $this->createUser();
// And three nodes.
$requestTime = \Drupal::time()->getRequestTime();
$this->node1 = $this->createNode([
'type' => 'bar',
'title' => 'foo',
'status' => 1,
'uid' => $admin->id(),
'created' => $requestTime - 10,
]);
$this->node2 = $this->createNode([
'type' => 'foo',
'title' => 'foo',
'status' => 1,
'uid' => $admin->id(),
'created' => $requestTime - 5,
]);
$this->node3 = $this->createNode([
'type' => 'bar',
'title' => 'bars',
'status' => 1,
'uid' => $admin->id(),
'created' => $requestTime,
]);
// Now create a user with the ability to edit bar but not foo.
$this->testUser = $this->createUser([
'access content overview',
'access content',
'edit any bar content',
'delete any bar content',
]);
// And switch to that user.
$this->container
->get('account_switcher')
->switchTo($this->testUser);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.