You are here

public function FillPdfOverviewFormTest::testOverviewFormUpload in FillPDF 8.4

Same name and namespace in other branches
  1. 5.0.x tests/src/Functional/FillPdfOverviewFormTest.php \Drupal\Tests\fillpdf\Functional\FillPdfOverviewFormTest::testOverviewFormUpload()

Tests the overview form's PDF file upload functionality.

File

tests/src/Functional/FillPdfOverviewFormTest.php, line 28

Class

FillPdfOverviewFormTest
@coversDefaultClass \Drupal\fillpdf\Form\FillPdfOverviewForm @group fillpdf

Namespace

Drupal\Tests\fillpdf\Functional

Code

public function testOverviewFormUpload() {

  // Without any file being supplied, nothing should happen at all,
  // particularly no FillPdfForm should be created.
  $this
    ->uploadTestPdf(NULL);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextNotContains('New FillPDF form has been created.');

  // Check if the 'accept' attribute is correctly set.
  $this
    ->assertSession()
    ->elementAttributeContains('css', 'input#edit-upload-pdf-upload', 'accept', 'application/pdf');

  // Run all upload tests.
  $this
    ->assertNotUploadTextFile(self::OP_UPLOAD);
  $this
    ->assertNotUploadTextFile(self::OP_CREATE);
  $this
    ->assertUploadPdfFile(self::OP_UPLOAD, FALSE);
  $this
    ->assertUploadPdfFile(self::OP_CREATE, FALSE);
}