From 608fc3490475b446ac03e67133882dbee1a8b175 Mon Sep 17 00:00:00 2001 From: pancho <pancho@15425.no-reply.drupal.org> Date: Fri, 31 May 2019 10:43:36 -0400 Subject: [PATCH] Issue #3053622 by Pancho, Liam Morland: Use case-sensitive database column for pdf_key --- fillpdf.install | 13 +++++++++++++ fillpdf.module | 8 +++++++- tests/FillPdfTestHelper.test | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/fillpdf.install b/fillpdf.install index 5a1cc23..bdc1f4f 100644 --- a/fillpdf.install +++ b/fillpdf.install @@ -70,6 +70,7 @@ function fillpdf_schema() { 'pdf_key' => array( 'type' => 'varchar', 'length' => 255, + 'binary' => TRUE, 'not null' => TRUE, ), 'label' => array( @@ -398,3 +399,15 @@ function fillpdf_update_7107() { 'length' => 255, )); } + +/** + * Mark {fillpdf_fields}.pdf_key BINARY to make it behave case-sensitive. + */ +function fillpdf_update_7108() { + db_change_field('fillpdf_fields', 'pdf_key', 'pdf_key', array( + 'type' => 'varchar', + 'length' => 255, + 'binary' => TRUE, + 'not null' => TRUE, + )); +} diff --git a/fillpdf.module b/fillpdf.module index 6a8aad0..78c0cb3 100644 --- a/fillpdf.module +++ b/fillpdf.module @@ -1783,8 +1783,14 @@ function fillpdf_execute_parse($method, $fillpdf, $mode = 'url') { 'value' => '', 'type' => 'Text', ), - // Test duplicate name. + // Test field name only different in case. 3 => array( + 'name' => 'textfield', + 'value' => '', + 'type' => 'Text', + ), + // Test duplicate field name that should be consolidated. + 4 => array( 'name' => 'ImageField', 'value' => '', 'type' => 'Pushbutton', diff --git a/tests/FillPdfTestHelper.test b/tests/FillPdfTestHelper.test index c8681cf..12c2d37 100644 --- a/tests/FillPdfTestHelper.test +++ b/tests/FillPdfTestHelper.test @@ -41,7 +41,7 @@ trait FillPdfTestHelper { 'files[upload_pdf]' => drupal_realpath(drupal_get_path('module', 'fillpdf') . '/tests/fillpdf_test_v4.pdf'), ), t('Upload')); $this->assertText('fillpdf_test_v4.pdf was successfully uploaded.'); - $this->assertResponse(200, "The duplicate field is consolidated and doesn't lead to an integrity constraint violation."); + $this->assertResponse(200, 'No integrity constraint violation.'); } /** -- GitLab