You are here

public function RecipeTranslationTest::setUp in Recipe 7

File

src/Tests/RecipeTranslationTest.php, line 31

Class

RecipeTranslationTest
Tests translating Recipe nodes.

Namespace

Drupal\recipe\Tests

Code

public function setUp() {

  // Enable modules required for testing. Bypass \TranslationTestCase::setUp()
  // because we don't want the configuration that it sets up.
  parent::setUp(array(
    'locale',
    'recipe',
    'translation',
  ));

  // Create and log in the admin user with Recipe content permissions.
  $this->adminUser = $this
    ->drupalCreateUser(array(
    'administer content types',
    'administer languages',
    'administer site configuration',
    'bypass node access',
    'translate content',
  ));
  $this
    ->drupalLogin($this->adminUser);

  // Add languages.
  $this
    ->addLanguage('en');
  $this
    ->addLanguage('es');

  // Set Recipes to use multilingual support with translation.
  $this
    ->drupalGet('admin/structure/types/manage/recipe');
  $edit = array();
  $edit['language_content_type'] = 2;
  $this
    ->drupalPost('admin/structure/types/manage/recipe', $edit, t('Save content type'));
  $this
    ->assertRaw(t('The content type %type has been updated.', array(
    '%type' => 'Recipe',
  )), 'Recipe content type has been updated.');
}