From d803f389b46ca6ab7ea4b2cccbb77c9ffcdc5dbe Mon Sep 17 00:00:00 2001
From: lkmorlan <lkmorlan@493050.no-reply.drupal.org>
Date: Fri, 31 May 2019 18:18:32 -0400
Subject: [PATCH] Issue #2957163 by Liam Morland, Pancho: Run
 FillPdfMergeTestCase->backendTest on pdftk

---
 tests/FillPdfMergeTestCase.test | 18 ++++++++++++++++++
 tests/FillPdfTestHelper.test    |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/tests/FillPdfMergeTestCase.test b/tests/FillPdfMergeTestCase.test
index 269f5fd..356f847 100644
--- a/tests/FillPdfMergeTestCase.test
+++ b/tests/FillPdfMergeTestCase.test
@@ -534,6 +534,24 @@ class FillPdfMergeTestCase extends ImageFieldTestCase {
     $this->backendTest();
   }
 
+  /**
+   * Tests PDF merging using a local install of pdftk.
+   */
+  public function testPdftkPdfMerging() {
+    $this->configurePdftkBackend();
+    if (!fillpdf_pdftk_check()) {
+      // No pdftk installed, so don't run any assertions.
+      return;
+    }
+
+    // The testing UI doesn't clearly indicate that these tests are being run by
+    // default because we delegate to backendTest(). This is a convenience
+    // marker.
+    $this->assertTrue(TRUE, 'Detected pdftk. Running tests.');
+
+    $this->backendTest();
+  }
+
   /**
    *
    */
diff --git a/tests/FillPdfTestHelper.test b/tests/FillPdfTestHelper.test
index a63b97c..780724d 100644
--- a/tests/FillPdfTestHelper.test
+++ b/tests/FillPdfTestHelper.test
@@ -56,6 +56,14 @@ trait FillPdfTestHelper {
     variable_set('fillpdf_local_service_endpoint', 'http://127.0.0.1:8085');
   }
 
+  /**
+   * Configures FillPdf using the pdftk backend.
+   */
+  protected function configurePdftkBackend() {
+    variable_set('fillpdf_service', 'pdftk');
+    variable_set('fillpdf_scheme', 'private');
+  }
+
   /**
    * Get the fid of the uploaded file to construct the link.
    *
-- 
GitLab