protected function setUp() { parent::setUp(); // Create test user and login. $web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases')); $this->drupalLogin($web_user); }
protected function setUp() { parent::setUp(); // Create a Tags vocabulary for the Article node type. $vocabulary = entity_create('taxonomy_vocabulary', array('name' => t('Tags'), 'vid' => 'tags')); $vocabulary->save(); // Create and login user. $web_user = $this->drupalCreateUser(array('administer url aliases', 'administer taxonomy', 'access administration pages')); $this->drupalLogin($web_user); }
protected function setUp() { parent::setUp(); // Create and login user. $web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'access administration pages')); $this->drupalLogin($web_user); // Enable French language. $edit = array(); $edit['predefined_langcode'] = 'fr'; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); // Enable URL language detection and selection. $edit = array('language_interface[enabled][language-url]' => 1); $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); }
function setUp() { parent::setUp(); $permissions = array('access administration pages', 'administer content translation', 'administer content types', 'administer languages', 'administer url aliases', 'create content translations', 'create page content', 'create url aliases', 'edit any page content', 'translate any entity'); // Create and login user. $this->web_user = $this->drupalCreateUser($permissions); $this->drupalLogin($this->web_user); // Enable French language. $edit = array(); $edit['predefined_langcode'] = 'fr'; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); // Enable URL language detection and selection. $edit = array('language_interface[enabled][language-url]' => 1); $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); // Enable translation for page node. $edit = array('entity_types[node]' => 1, 'settings[node][page][translatable]' => 1, 'settings[node][page][fields][path]' => 1, 'settings[node][page][fields][body]' => 1, 'settings[node][page][settings][language][language_show]' => 1); $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save')); $definitions = \Drupal::entityManager()->getFieldDefinitions('node', 'page'); $this->assertTrue($definitions['path']->isTranslatable(), 'Node path is translatable.'); $this->assertTrue($definitions['body']->isTranslatable(), 'Node body is translatable.'); }