Bug 18104: [QA Follow-up] Add a test for customized name in AE
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 23 Jun 2017 08:12:44 +0000 (10:12 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 6 Jul 2017 17:52:55 +0000 (14:52 -0300)
Test plan:
Run t/db_dependent/SIP/Message.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/SIP/Message.t

index 217f328..0c1ebcc 100755 (executable)
@@ -70,7 +70,7 @@ subtest 'Testing Patron Status Request V2' => sub {
 
 subtest 'Testing Patron Info Request V2' => sub {
     $schema->storage->txn_begin;
-    plan tests => 17;
+    plan tests => 18;
     $C4::SIP::Sip::protocol_version = 2;
     test_request_patron_info_v2();
     $schema->storage->txn_rollback;
@@ -186,6 +186,15 @@ sub test_request_patron_info_v2 {
     # No check for custom fields here (unofficial PB, PC and PI)
     check_field( $respcode, $response, FID_SCREEN_MSG, '.+', 'We have a screen msg', 'regex' );
 
+    # Test customized patron name in AE with same sip request
+    # This implicitly tests C4::SIP::ILS::Patron->name
+    $server->{account}->{ae_field_template} = "X[% patron.surname %]Y";
+    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
+    undef $response;
+    $msg->handle_patron_info( $server );
+    $respcode = substr( $response, 0, 2 );
+    check_field( $respcode, $response, FID_PERSONAL_NAME, 'X' . $patron2->{surname} . 'Y', 'Check customized patron name' );
+
     # Check empty password and verify CQ again
     $siprequest = PATRON_INFO. 'engYYYYMMDDZZZZHHMMSS'.'Y         '.
         FID_INST_ID. $branchcode. '|'.