protected function VoteCreationTest::setUp in Voting API 8.3
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ VoteCreationTest.php, line 36
Class
- VoteCreationTest
- Tests the Voting API basics.
Namespace
Drupal\Tests\votingapi\FunctionalCode
protected function setUp() {
parent::setUp();
// Create Basic page and Article node types.
if ($this->profile != 'standard') {
$node_type = $this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
'display_submitted' => FALSE,
]);
node_add_body_field($node_type);
}
$this
->drupalLogin($this
->drupalCreateUser());
$title = $this
->randomMachineName(8);
$node = Node::create([
'type' => 'page',
]);
$node
->setOwner($this->loggedInUser);
$node
->setTitle($title);
$node
->set('body', [
'value' => $this
->randomMachineName(16),
]);
$node
->save();
$this->node = $this
->drupalGetNodeByTitle($title);
$this
->assertNotEmpty($this->node, 'Basic page created for Voting API tests.');
}