/** * {@inheritdoc} */ protected function setUpFixtures() { $this->installEntitySchema('user'); $this->installEntitySchema('entity_test'); $this->installConfig(['entity_test']); Block::create(['id' => 'test_block', 'plugin' => 'system_main_block'])->save(); parent::setUpFixtures(); }
/** * {@inheritdoc} */ protected function setUpFixtures() { parent::setUpFixtures(); $this->installEntitySchema('user'); $this->installEntitySchema('entity_test'); // Create some test entities. for ($i = 0; $i < 5; $i++) { EntityTest::create(['name' => $this->randomString()])->save(); } // Create and admin user. $this->adminUser = $this->createUser([], FALSE, TRUE); }
protected function setUpFixtures() { $this->installEntitySchema('user'); $this->installEntitySchema('node'); $this->installEntitySchema('comment'); $this->installSchema('comment', array('comment_entity_statistics')); $this->installConfig(array('system', 'field', 'node', 'comment')); entity_create('node_type', array('type' => 'page', 'name' => 'Page'))->save(); $this->addDefaultCommentField('node', 'page'); parent::setUpFixtures(); $this->installConfig(array('filter')); }
/** * {@inheritdoc} */ protected function setUpFixtures() { parent::setUpFixtures(); $this->installEntitySchema('user'); $this->installEntitySchema('entity_test'); $this->installConfig(['user']); // Create some test entities. for ($i = 0; $i < 5; $i++) { EntityTest::create(['name' => $this->randomString()])->save(); } // Create and admin user. $this->adminUser = $this->createUser(['view test entity'], FALSE, TRUE); Role::load(AccountInterface::ANONYMOUS_ROLE)->grantPermission('view test entity')->save(); }
/** * {@inheritdoc} */ protected function setUpFixtures() { parent::setUpFixtures(); $this->installEntitySchema('user'); $this->installEntitySchema('node'); $this->installSchema('node', 'node_access'); $type = NodeType::create(['type' => 'test']); $type->save(); $this->editorUser = $this->createUser(['bypass node access']); $this->powerUser = $this->createUser(['access content', 'create test content', 'edit own test content', 'delete own test content']); $this->regularUser = $this->createUser(['access content']); // Create some test entities. for ($i = 0; $i < 5; $i++) { Node::create(['title' => 'b' . $i . $this->randomMachineName(), 'type' => 'test'])->save(); } // Create a power user node. Node::create(['title' => 'z' . $this->randomMachineName(), 'uid' => $this->powerUser->id(), 'type' => 'test'])->save(); }
/** * {@inheritdoc} */ protected function setUpFixtures() { $this->installEntitySchema('user'); $this->installEntitySchema('entity_test'); $this->installConfig(['entity_test']); EntityViewMode::create(['id' => 'entity_test.foobar', 'targetEntityType' => 'entity_test', 'status' => TRUE, 'enabled' => TRUE, 'label' => 'My view mode'])->save(); $display = EntityViewDisplay::create(['targetEntityType' => 'entity_test', 'bundle' => 'entity_test', 'mode' => 'foobar', 'label' => 'My view mode', 'status' => TRUE]); $display->save(); $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'entity_test', 'type' => 'string']); $field_storage->save(); $field_config = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'entity_test', 'bundle' => 'entity_test']); $field_config->save(); // Create some test entities. for ($i = 1; $i <= 3; $i++) { EntityTest::create(['name' => "Article title {$i}", 'test_field' => "Test {$i}"])->save(); } $role = Role::create(['id' => 'test_role']); $role->grantPermission('bypass node access'); $role->save(); $this->user = User::create(['name' => 'test user']); $this->user->addRole($role->id()); $this->user->save(); parent::setUpFixtures(); }