public function FillPdfSettingsFormTest::testBackendFillPdfService in FillPDF 5.0.x
Same name and namespace in other branches
- 8.4 tests/src/Functional/FillPdfSettingsFormTest.php \Drupal\Tests\fillpdf\Functional\FillPdfSettingsFormTest::testBackendFillPdfService()
Tests the backend settings with the 'fillpdf_service' backend.
File
- tests/
src/ Functional/ FillPdfSettingsFormTest.php, line 173
Class
- FillPdfSettingsFormTest
- @coversDefaultClass \Drupal\fillpdf\Form\FillPdfSettingsForm @group fillpdf
Namespace
Drupal\Tests\fillpdf\FunctionalCode
public function testBackendFillPdfService() {
// FillPDF is not yet configured. The settings form is however initialized
// with the 'fillpdf_service' backend. Save that configuration.
$this
->drupalPostForm(Url::fromRoute('fillpdf.settings'), NULL, 'Save configuration');
// There's currently no validation, so the 'backend' setting should be
// both submitted and stored.
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
$this
->assertSession()
->fieldValueEquals('backend', 'fillpdf_service');
$this
->assertEqual($this
->config('fillpdf.settings')
->get('backend'), 'fillpdf_service');
// Now add an API key and save again.
$this
->drupalPostForm(NULL, [
'fillpdf_service_api_key' => 'Invalid, just playing around.',
], 'Save configuration');
// There's currently no validation, so the obviously invalid
// 'fillpdf_service_api_key' should be both submitted and stored.
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
$this
->assertSession()
->fieldValueEquals('fillpdf_service_api_key', 'Invalid, just playing around.');
$this
->assertEqual($this
->config('fillpdf.settings')
->get('fillpdf_service_api_key'), 'Invalid, just playing around.');
}