public function LingotekProfileFormTest::testAddingProfile in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 4.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.1.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.2.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.3.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.4.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.5.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.6.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
- 3.8.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testAddingProfile()
Test adding a profile are present.
File
- tests/
src/ Functional/ Form/ LingotekProfileFormTest.php, line 76
Class
- LingotekProfileFormTest
- Tests the Lingotek profile form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testAddingProfile() {
$assert_session = $this
->assertSession();
$this
->drupalGet('admin/lingotek/settings');
$this
->clickLink(t('Add new Translation Profile'));
$profile_id = strtolower($this
->randomMachineName());
$profile_name = $this
->randomString();
$edit = [
'id' => $profile_id,
'label' => $profile_name,
'auto_upload' => 1,
'auto_request' => 1,
'auto_download' => 1,
'append_type_to_title' => 'yes',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
$this
->assertText(t('The Lingotek profile has been successfully saved.'));
// We can edit them.
$assert_session
->linkByHrefExists("/admin/lingotek/settings/profile/{$profile_id}/edit");
$this
->assertFieldChecked("edit-profile-{$profile_id}-auto-upload");
$this
->assertFieldChecked("edit-profile-{$profile_id}-auto-request");
$this
->assertFieldChecked("edit-profile-{$profile_id}-auto-download");
$this
->assertFieldEnabled("edit-profile-{$profile_id}-auto-upload");
$this
->assertFieldEnabled("edit-profile-{$profile_id}-auto-request");
$this
->assertFieldEnabled("edit-profile-{$profile_id}-auto-download");
/** @var \Drupal\lingotek\LingotekProfileInterface $profile */
$profile = LingotekProfile::load($profile_id);
$this
->assertTrue($profile
->hasAutomaticUpload());
$this
->assertTrue($profile
->hasAutomaticRequest());
$this
->assertTrue($profile
->hasAutomaticDownload());
$this
->assertIdentical('yes', $profile
->getAppendContentTypeToTitle());
$this
->assertIdentical('default', $profile
->getProject());
$this
->assertIdentical('default', $profile
->getVault());
$this
->assertIdentical('default', $profile
->getWorkflow());
$this
->assertFalse($profile
->hasIntelligenceMetadataOverrides());
$this
->assertIdentical('drupal_default', $profile
->getFilter());
$this
->assertIdentical('drupal_default', $profile
->getSubfilter());
}