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

(-)a/t/db_dependent/Koha/Patron/Relationship.t (-3 / +30 lines)
Lines 35-41 my $builder = t::lib::TestBuilder->new; Link Here
35
35
36
subtest 'store() tests' => sub {
36
subtest 'store() tests' => sub {
37
37
38
    plan tests => 9;
38
    plan tests => 13;
39
39
40
    $schema->storage->txn_begin;
40
    $schema->storage->txn_begin;
41
41
Lines 76-82 subtest 'store() tests' => sub { Link Here
76
        'No guarantors added'
76
        'No guarantors added'
77
    );
77
    );
78
78
79
    $relationship_1->relationship('father1')->store;
79
    $relationship = '';
80
81
    throws_ok
82
        { $relationship_1->relationship($relationship)->store; }
83
        'Koha::Exceptions::Patron::Relationship::InvalidRelationship',
84
        'Exception is thrown as a wrong relationship was passed';
85
86
    is( "$@", "Invalid relationship passed, '$relationship' is not defined.", 'Exception stringified correctly' );
87
88
    is( Koha::Patron::Relationships->search( { guarantee_id => $patron_1->borrowernumber } )->count,
89
        0,
90
        'No guarantors added when empty relationship passed and not defined'
91
    );
92
93
    $relationship = 'father1';
94
95
    $relationship_1->relationship($relationship)->store;
80
96
81
    is( Koha::Patron::Relationships->search( { guarantee_id => $patron_1->borrowernumber } )->count,
97
    is( Koha::Patron::Relationships->search( { guarantee_id => $patron_1->borrowernumber } )->count,
82
        1,
98
        1,
Lines 108-112 subtest 'store() tests' => sub { Link Here
108
        );
124
        );
109
    }
125
    }
110
126
127
    t::lib::Mocks::mock_preference( 'borrowerRelationship', '' );
128
129
    my $relationship_3 = Koha::Patron::Relationship->new(
130
        {
131
            guarantor_id => $patron_1->borrowernumber,
132
            guarantee_id => $patron_2->borrowernumber,
133
            relationship => ''
134
        }
135
    )->store();
136
137
    is( $relationship_3->relationship, '', 'Empty relationship allowed' );
138
111
    $schema->storage->txn_rollback;
139
    $schema->storage->txn_rollback;
112
};
140
};
113
- 

Return to bug 25946