Bug 18461: Make tests break on wrong UTF8 data handilng
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 24 Apr 2017 18:45:17 +0000 (15:45 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 28 Apr 2017 10:24:22 +0000 (06:24 -0400)
This patch makes the tests fail if extended attributes handling fails due to
wrong UTF-8 data handling.

To test:
- Run:
  $ sudo koha-shell kohadev
 k$ cd kohaclone
 k$ prove t/db_dependent/Koha/Patron/Modifications.t
=> FAIL: Tests explode

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Koha/Patron/Modifications.t

index 7c5593a..af6df4c 100755 (executable)
@@ -17,6 +17,8 @@
 
 use Modern::Perl;
 
+use utf8;
+
 use Test::More tests => 6;
 use Test::Exception;
 
@@ -304,7 +306,7 @@ subtest 'pending_count() and pending() tests' => sub {
             surname            => 'Smith',
             firstname          => 'Sandy',
             verification_token => $verification_token_2,
-            extended_attributes => '[{"code":"CODE_2","value":"chau"},{"code":"CODE_2","value":"ciao"}]'
+            extended_attributes => '[{"code":"CODE_2","value":"año"},{"code":"CODE_2","value":"ciao"}]'
         }
     )->store();
 
@@ -341,7 +343,7 @@ subtest 'pending_count() and pending() tests' => sub {
     is( ref($p2_pm_attribute_1), 'Koha::Patron::Attribute', 'patron modification has single attribute object' );
     is( ref($p2_pm_attribute_2), 'Koha::Patron::Attribute', 'patron modification has single attribute object' );
 
-    is( $p2_pm_attribute_1->attribute, 'chau', 'patron modification has the right attribute change' );
+    is( $p2_pm_attribute_1->attribute, 'año', 'patron modification has the right attribute change' );
     is( $p2_pm_attribute_2->attribute, 'ciao', 'patron modification has the right attribute change' );
 
     is( Koha::Patron::Modifications->pending_count($library_1),