View | Details | Raw Unified | Return to bug 26157
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patron.t (-6 / +9 lines)
Lines 64-75 subtest 'add_guarantor() tests' => sub { Link Here
64
64
65
    is( $guarantors->count, 1, 'No guarantors added' );
65
    is( $guarantors->count, 1, 'No guarantors added' );
66
66
67
    $SIG{__WARN__} = sub {}; # FIXME: PrintError = 0 not working!
67
    {
68
68
        local *STDERR;
69
    throws_ok
69
        open STDERR, '>', '/dev/null';
70
        { $patron_1->add_guarantor({ guarantor_id => $patron_2->borrowernumber, relationship => 'father2' }); }
70
        throws_ok
71
        'Koha::Exceptions::Patron::Relationship::DuplicateRelationship',
71
            { $patron_1->add_guarantor({ guarantor_id => $patron_2->borrowernumber, relationship => 'father2' }); }
72
        'Exception is thrown for duplicated relationship';
72
            'Koha::Exceptions::Patron::Relationship::DuplicateRelationship',
73
            'Exception is thrown for duplicated relationship';
74
        close STDERR;
75
    }
73
76
74
    $schema->storage->txn_rollback;
77
    $schema->storage->txn_rollback;
75
};
78
};
(-)a/t/db_dependent/Koha/Patron/Relationship.t (-17 / +17 lines)
Lines 90-111 subtest 'store() tests' => sub { Link Here
90
        }
90
        }
91
    );
91
    );
92
92
93
    $SIG{__WARN__} = sub {}; # FIXME: PrintError = 0 not working!
93
    {
94
94
        local *STDERR;
95
    throws_ok
95
        open STDERR, '>', '/dev/null';
96
        { $relationship_2->store; }
96
        throws_ok
97
        'Koha::Exceptions::Patron::Relationship::DuplicateRelationship',
97
            { $relationship_2->store; }
98
        'Exception is thrown for duplicated relationship';
98
            'Koha::Exceptions::Patron::Relationship::DuplicateRelationship',
99
99
            'Exception is thrown for duplicated relationship';
100
    is( "$@",
100
101
        "There already exists a relationship for the same guarantor ("
101
        is( "$@",
102
            . $patron_2->borrowernumber
102
            "There already exists a relationship for the same guarantor ("
103
            . ") and guarantee ("
103
                . $patron_2->borrowernumber
104
            . $patron_1->borrowernumber
104
                . ") and guarantee ("
105
            . ") combination",
105
                . $patron_1->borrowernumber
106
        'Exception stringified correctly'
106
                . ") combination",
107
    );
107
            'Exception stringified correctly'
108
108
        );
109
    }
109
110
110
    $schema->storage->txn_rollback;
111
    $schema->storage->txn_rollback;
111
};
112
};
112
- 

Return to bug 26157