protected function FillPdfUploadTestBase::assertNotUploadTextFile in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x tests/src/Functional/FillPdfUploadTestBase.php \Drupal\Tests\fillpdf\Functional\FillPdfUploadTestBase::assertNotUploadTextFile()
Asserts that a text file may not be uploaded.
Parameters
string $op: (optional) Operation to perform. May be either of:
- ::OP_UPLOAD (default),
- ::OP_CREATE, or
- ::OP_SAVE.
2 calls to FillPdfUploadTestBase::assertNotUploadTextFile()
- FillPdfFormFormTest::testFormFormUpload in tests/
src/ Functional/ FillPdfFormFormTest.php - Tests the FillPdfForm entity's edit form.
- FillPdfOverviewFormTest::testOverviewFormUpload in tests/
src/ Functional/ FillPdfOverviewFormTest.php - Tests the overview form's PDF file upload functionality.
File
- tests/
src/ Functional/ FillPdfUploadTestBase.php, line 55
Class
- FillPdfUploadTestBase
- Allows testing everything around uploading PDF template files.
Namespace
Drupal\Tests\fillpdf\FunctionalCode
protected function assertNotUploadTextFile($op = self::OP_UPLOAD) {
$previous_file_id = $this
->getLastFileId();
// Try uploading a text file in the managed file widget.
$edit = [
'files[upload_pdf]' => $this
->getTestFile('text')
->getFileUri(),
];
$this
->drupalPostForm(NULL, $edit, $op);
// Whether submitted or just uploaded, the validation should set an error
// and the file shouldn't end up being uploaded.
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('Only files with the following extensions are allowed: pdf.');
$this
->assertEquals($previous_file_id, $this
->getLastFileId());
// Make sure FillPdf Forms were not affected.
$this
->assertSession()
->pageTextNotContains('New FillPDF form has been created.');
$this
->assertSession()
->pageTextNotContains('Your previous field mappings have been transferred to the new PDF template you uploaded.');
}