You are here

protected function TestFillPdfTrait::uploadTestPdf in FillPDF 5.0.x

Same name and namespace in other branches
  1. 8.4 tests/src/Traits/TestFillPdfTrait.php \Drupal\Tests\fillpdf\Traits\TestFillPdfTrait::uploadTestPdf()

Uploads a specified PDF testfile, if given.

Parameters

string|null $filename: (optional) Filename of the PDF testfile. Defaults to NULL.

27 calls to TestFillPdfTrait::uploadTestPdf()
FillPdfFormDeleteFormTest::testDeleteForm in tests/src/Functional/FillPdfFormDeleteFormTest.php
Tests the cancel link works.
FillPdfFormDeleteFormTest::testDeleteFormCancel in tests/src/Functional/FillPdfFormDeleteFormTest.php
Tests the cancel link works.
FillPdfFormDuplicateFormTest::testDuplicateForm in tests/src/Functional/FillPdfFormDuplicateFormTest.php
Tests the duplicate function.
FillPdfFormFormTest::testDefaultEntityId in tests/src/Functional/FillPdfFormFormTest.php
Tests the FillPdfForm entity's edit form.
FillPdfFormFormTest::testFillPdfFileUsage in tests/src/Functional/FillPdfFormFormTest.php
Tests proper registration of managed_files.

... See full list

File

tests/src/Traits/TestFillPdfTrait.php, line 106

Class

TestFillPdfTrait
Provides methods for testing FillPdf.

Namespace

Drupal\Tests\fillpdf\Traits

Code

protected function uploadTestPdf($filename = NULL) {
  if ($filename) {
    $path = $this
      ->getTestPdfPath($filename);
    $this
      ->assertNotFalse($path);
  }
  $edit = [
    'files[upload_pdf]' => isset($path) ? $path : NULL,
  ];
  $this
    ->drupalPostForm('admin/structure/fillpdf', $edit, 'Create');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}