public function LingotekProfileFormTest::testEditingProfile in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 4.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.0.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.1.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.3.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.4.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.5.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.6.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.7.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
- 3.8.x tests/src/Functional/Form/LingotekProfileFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekProfileFormTest::testEditingProfile()
Test editing profiles.
File
- tests/
src/ Functional/ Form/ LingotekProfileFormTest.php, line 113
Class
- LingotekProfileFormTest
- Tests the Lingotek profile form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testEditingProfile() {
/** @var \Drupal\lingotek\LingotekProfileInterface $profile */
$profile = LingotekProfile::create([
'id' => strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
]);
$profile
->save();
$profile_id = $profile
->id();
$this
->assertIdentical('global_setting', $profile
->getAppendContentTypeToTitle());
$this
->drupalGet("/admin/lingotek/settings/profile/{$profile_id}/edit");
$edit = [
'auto_upload' => FALSE,
'auto_download' => 1,
'project' => 'test_project',
'vault' => 'test_vault',
'workflow' => 'test_workflow',
'filter' => 'test_filter',
'subfilter' => 'another_filter',
'append_type_to_title' => 'no',
];
$this
->drupalPostForm(NULL, $edit, t('Save'));
/** @var \Drupal\lingotek\LingotekProfileInterface $profile */
$profile = LingotekProfile::load($profile_id);
$this
->assertFalse($profile
->hasAutomaticUpload());
$this
->assertTrue($profile
->hasAutomaticDownload());
$this
->assertIdentical('no', $profile
->getAppendContentTypeToTitle());
$this
->assertIdentical('test_project', $profile
->getProject());
$this
->assertIdentical('test_vault', $profile
->getVault());
$this
->assertIdentical('test_workflow', $profile
->getWorkflow());
$this
->assertIdentical('test_filter', $profile
->getFilter());
$this
->assertIdentical('another_filter', $profile
->getSubfilter());
$this
->drupalGet("/admin/lingotek/settings/profile/{$profile_id}/edit");
$this
->assertNoFieldChecked("edit-auto-upload");
$this
->assertFieldChecked("edit-auto-download");
$this
->assertOptionSelected('edit-append-type-to-title', 'no');
$this
->assertOptionSelected('edit-project', 'test_project');
$this
->assertOptionSelected('edit-vault', 'test_vault');
$this
->assertOptionSelected('edit-workflow', 'test_workflow');
$this
->assertOptionSelected('edit-filter', 'test_filter');
$this
->assertOptionSelected('edit-subfilter', 'another_filter');
}