You are here

public function FillPdfSettingsFormTest::testTemplateSchemeDummyRemote in FillPDF 5.0.x

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/FillPdfSettingsFormTest.php \Drupal\Tests\fillpdf\Functional\FillPdfSettingsFormTest::testTemplateSchemeDummyRemote()

Tests the scheme settings with the 'dummy_remote' stream wrapper.

File

tests/src/Functional/FillPdfSettingsFormTest.php, line 74

Class

FillPdfSettingsFormTest
@coversDefaultClass \Drupal\fillpdf\Form\FillPdfSettingsForm @group fillpdf

Namespace

Drupal\Tests\fillpdf\Functional

Code

public function testTemplateSchemeDummyRemote() {

  // FillPDF is not yet configured.
  // Verify the 'dummy_remote' stream wrapper is present on the form.
  $this
    ->drupalGet(Url::fromRoute('fillpdf.settings'));
  $this
    ->assertSession()
    ->elementExists('css', '#edit-template-scheme-dummy-remote');

  // Programmatically configure 'dummy_remote' as new default scheme.
  $this
    ->configureFillPdf([
    'template_scheme' => 'dummy_remote',
  ]);

  // Now uninstall the file_test module with the dummy stream wrappers.
  $this
    ->assertTrue(\Drupal::service('module_installer')
    ->uninstall([
    'file_test',
  ]), "Module 'file_test' has been uninstalled.");
  $this
    ->assertFalse(\Drupal::moduleHandler()
    ->moduleExists('file_test'), "Module 'file_test' is no longer present.");

  // Reload the page and verify that 'dummy_remote' is gone.
  $this
    ->drupalGet(Url::fromRoute('fillpdf.settings'));
  $this
    ->assertSession()
    ->elementNotExists('css', '#edit-template-scheme-dummy-remote');
  $this
    ->assertSession()
    ->pageTextContains('Your previously used file storage dummy_remote:// is no longer available');
}