https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23538

Marcel de Rooy <m.de.r...@rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.de.r...@rijksmuseum.nl

--- Comment #36 from Marcel de Rooy <m.de.r...@rijksmuseum.nl> ---
+    t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'root@localhost'
);
+    t::lib::Mocks::mock_preference( 'EmailAddressForPatronRegistrations',
'library@localhost' );
+
+    # Test when EmailPatronRegistrations equals BranchEmailAddress
+    t::lib::Mocks::mock_preference( 'EmailPatronRegistrations',
'BranchEmailAddress' );
+    is(
$patron->notify_library_of_registration(C4::Context->preference('EmailPatronRegistrations')),
1, 'OPAC_REG email is queued if EmailPatronRegistration syspref equals
BranchEmailAddress');
+    my $sth = $dbh->prepare("SELECT to_address FROM message_queue where
borrowernumber = ?");
+    $sth->execute( $patron->borrowernumber );
+    my $to_address = $sth->fetchrow_array;
+    is( $to_address, 't...@mybranch.com', 'OPAC_REG email queued to go to
branchreplyto address when EmailPatronRegistration equals BranchEmailAddress'
);
+    $dbh->do(q|DELETE FROM message_queue|);
+
+    # Test when EmailPatronRegistrations equals
EmailAddressForPatronRegistrations
+    t::lib::Mocks::mock_preference( 'EmailPatronRegistrations',
'EmailAddressForPatronRegistrations' );
+    is(
$patron->notify_library_of_registration(C4::Context->preference('EmailPatronRegistrations')),
1, 'OPAC_REG email is queued if EmailPatronRegistration syspref equals
EmailAddressForPatronRegistrations');
+    $sth->execute( $patron->borrowernumber );
+    $to_address = $sth->fetchrow_array;
+    is( $to_address, 'library@localhost', 'OPAC_REG email queued to go to
EmailAddressForPatronRegistrations syspref when EmailPatronRegistration equals
EmailAddressForPatronRegistrations' );
+    $dbh->do(q|DELETE FROM message_queue|);
+
+    # Test when EmailPatronRegistrations equals KohaAdminEmailAddress
+    t::lib::Mocks::mock_preference( 'EmailPatronRegistrations',
'KohaAdminEmailAddress' );
+    is(
$patron->notify_library_of_registration(C4::Context->preference('EmailPatronRegistrations')),
1, 'OPAC_REG email is queued if EmailPatronRegistration syspref equals
KohaAdminEmailAddress');
+    $sth->execute( $patron->borrowernumber );
+    $to_address = $sth->fetchrow_array;
+    is( $to_address, 'root@localhost', 'OPAC_REG email queued to go to
KohaAdminEmailAddress syspref when EmailPatronRegistration equals
KohaAdminEmailAddress' );
+    $dbh->do(q|DELETE FROM message_queue|);

This part of the test fails with me:
    not ok 6 - OPAC_REG email queued to go to KohaAdminEmailAddress syspref
when EmailPatronRegistration equals KohaAdminEmailAddress
    #   Failed test 'OPAC_REG email queued to go to KohaAdminEmailAddress
syspref when EmailPatronRegistration equals KohaAdminEmailAddress'
    #   at t/db_dependent/Koha/Patron.t line 1347.
    #          got: 'biblioth...@master.rijkskoha.nl'
    #     expected: 'root@localhost'
    # Looks like you failed 1 test of 6.

Also note that you'd better not use localhost as an email address in your
tests. 
And that you include several SQL statements that should be Koha objects.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to