/** * {@inheritdoc} */ public function setUp() { parent::setUp(); // Setup an admin user. $admin_user = $this->createUser([ 'administer flags', 'administer flagging display', 'administer node display', 'administer modules', ]); // Login. $this->drupalLogin($admin_user); // Create some flags. for ($i = 0; $i < 2; $i++) { $flag = $this->createFlag('node', ['article'], 'reload');; $this->grantFlagPermissions($flag); $this->flags[$i] = $flag; } // Create some nodes. for ($i = 0; $i < 3; $i++) { $this->nodes[$i] = $this->drupalCreateNode(['type' => 'article']); } // Flag some nodes. $this->flagService->flag($this->flags[0], $this->nodes[1]); $this->flagService->flag($this->flags[0], $this->nodes[2]); $this->flagService->flag($this->flags[1], $this->nodes[2]); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->entityQueryManager = $this->container->get('entity.query'); // Create a node to flag. $this->node = $this->drupalCreateNode(['type' => $this->nodeType]); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // The breadcrumb block is needed for FieldUiTestTrait's tests. $this->drupalPlaceBlock('system_breadcrumb_block'); $this->drupalPlaceBlock('local_tasks_block'); $this->drupalPlaceBlock('page_title_block'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Create a flag. $this->flag = $this->createFlag('node', ['article'], 'reload'); // Create a user who may flag and log them in. This ensures we don't have // to worry about flag access. $this->adminUser = $this->drupalCreateUser([ 'administer flags', // This permission is needed to change the view mode settings to show and // hide the flag link field. 'administer node display', ]); $this->grantFlagPermissions($this->flag); $this->drupalLogin($this->adminUser); // Create a node to flag. $this->node = Node::create([ 'body' => [ [ 'value' => $this->randomMachineName(32), 'format' => filter_default_format(), ], ], 'type' => 'article', 'title' => $this->randomMachineName(8), 'uid' => $this->adminUser->id(), 'status' => 1, // Promoted to front page to test teaser view mode. 'promote' => 1, 'sticky' => 0, ]); $this->node->save(); }