protected function PdfPopulationTest::backendTest in FillPDF 8.4
Same name and namespace in other branches
- 5.0.x tests/src/Functional/PdfPopulationTest.php \Drupal\Tests\fillpdf\Functional\PdfPopulationTest::backendTest()
Tests a backend.
Throws
\Behat\Mink\Exception\ResponseTextException
2 calls to PdfPopulationTest::backendTest()
- PdfPopulationTest::testMergeLocalService in tests/
src/ Functional/ PdfPopulationTest.php - Tests PDF population using local service.
- PdfPopulationTest::testMergePdftk in tests/
src/ Functional/ PdfPopulationTest.php - Tests PDF population using a local install of pdftk.
File
- tests/
src/ Functional/ PdfPopulationTest.php, line 371
Class
- PdfPopulationTest
- Tests Core entity population and image stamping.
Namespace
Drupal\Tests\fillpdf\FunctionalCode
protected function backendTest() {
// If we can upload a PDF, parsing is working.
// Test with a node.
$this
->uploadTestPdf('fillpdf_Ŧäßð_v3â.pdf');
$fillpdf_form = FillPdfForm::load($this
->getLatestFillPdfForm());
// Get the field definitions for the form that was created and configure
// them.
$fields = $fillpdf_form
->getFormFields();
FillPdfTestBase::mapFillPdfFieldsToEntityFields('node', $fields);
// Set up a test node.
$node = $this
->createNode([
'title' => 'Test',
'type' => 'article',
]);
// Hit the generation route, check the results from the test backend plugin.
$url = $this->linkManipulator
->generateLink([
'fid' => $fillpdf_form
->id(),
'entity_ids' => [
'node' => [
$node
->id(),
],
],
]);
$this
->drupalGet($url);
// Check if what we're seeing really is a PDF file.
$maybe_pdf = $this
->getSession()
->getPage()
->getContent();
static::assertEquals('application/pdf', $this
->getMimeType($maybe_pdf));
$this
->drupalGet('<front>');
$this
->assertSession()
->pageTextNotContains('Merging the FillPDF Form failed');
}