Lines 125-133
subtest 'constraints' => sub {
Link Here
|
125 |
"The suggestion is not deleted when the related branch is deleted" ); |
125 |
"The suggestion is not deleted when the related branch is deleted" ); |
126 |
|
126 |
|
127 |
# managerid |
127 |
# managerid |
128 |
throws_ok { $suggestion->managedby($nonexistent_borrowernumber)->store; } |
128 |
{ # hide useless warnings |
129 |
'Koha::Exceptions::Object::FKConstraint', |
129 |
local *STDERR; |
130 |
'store raises an exception on invalid managerid'; |
130 |
open STDERR, '>', '/dev/null'; |
|
|
131 |
throws_ok { |
132 |
$suggestion->managedby($nonexistent_borrowernumber)->store; |
133 |
} |
134 |
'Koha::Exceptions::Object::FKConstraint', |
135 |
'store raises an exception on invalid managerid'; |
136 |
close STDERR; |
137 |
} |
131 |
my $manager = $builder->build_object( { class => "Koha::Patrons" } ); |
138 |
my $manager = $builder->build_object( { class => "Koha::Patrons" } ); |
132 |
$suggestion->managedby( $manager->borrowernumber )->store; |
139 |
$suggestion->managedby( $manager->borrowernumber )->store; |
133 |
$manager->delete; |
140 |
$manager->delete; |
Lines 136-144
subtest 'constraints' => sub {
Link Here
|
136 |
"The suggestion is not deleted when the related manager is deleted" ); |
143 |
"The suggestion is not deleted when the related manager is deleted" ); |
137 |
|
144 |
|
138 |
# acceptedby |
145 |
# acceptedby |
139 |
throws_ok { $suggestion->acceptedby($nonexistent_borrowernumber)->store; } |
146 |
{ # hide useless warnings |
140 |
'Koha::Exceptions::Object::FKConstraint', |
147 |
local *STDERR; |
141 |
'store raises an exception on invalid acceptedby id'; |
148 |
open STDERR, '>', '/dev/null'; |
|
|
149 |
throws_ok { |
150 |
$suggestion->acceptedby($nonexistent_borrowernumber)->store; |
151 |
} |
152 |
'Koha::Exceptions::Object::FKConstraint', |
153 |
'store raises an exception on invalid acceptedby id'; |
154 |
close STDERR; |
155 |
} |
142 |
my $acceptor = $builder->build_object( { class => "Koha::Patrons" } ); |
156 |
my $acceptor = $builder->build_object( { class => "Koha::Patrons" } ); |
143 |
$suggestion->acceptedby( $acceptor->borrowernumber )->store; |
157 |
$suggestion->acceptedby( $acceptor->borrowernumber )->store; |
144 |
$acceptor->delete; |
158 |
$acceptor->delete; |
Lines 147-155
subtest 'constraints' => sub {
Link Here
|
147 |
"The suggestion is not deleted when the related acceptor is deleted" ); |
161 |
"The suggestion is not deleted when the related acceptor is deleted" ); |
148 |
|
162 |
|
149 |
# rejectedby |
163 |
# rejectedby |
150 |
throws_ok { $suggestion->rejectedby($nonexistent_borrowernumber)->store; } |
164 |
{ # hide useless warnings |
151 |
'Koha::Exceptions::Object::FKConstraint', |
165 |
local *STDERR; |
152 |
'store raises an exception on invalid rejectedby id'; |
166 |
open STDERR, '>', '/dev/null'; |
|
|
167 |
throws_ok { |
168 |
$suggestion->rejectedby($nonexistent_borrowernumber)->store; |
169 |
} |
170 |
'Koha::Exceptions::Object::FKConstraint', |
171 |
'store raises an exception on invalid rejectedby id'; |
172 |
close STDERR; |
173 |
} |
153 |
my $rejecter = $builder->build_object( { class => "Koha::Patrons" } ); |
174 |
my $rejecter = $builder->build_object( { class => "Koha::Patrons" } ); |
154 |
$suggestion->rejectedby( $rejecter->borrowernumber )->store; |
175 |
$suggestion->rejectedby( $rejecter->borrowernumber )->store; |
155 |
$rejecter->delete; |
176 |
$rejecter->delete; |
Lines 158-166
subtest 'constraints' => sub {
Link Here
|
158 |
"The suggestion is not deleted when the related rejecter is deleted" ); |
179 |
"The suggestion is not deleted when the related rejecter is deleted" ); |
159 |
|
180 |
|
160 |
# budgetid |
181 |
# budgetid |
161 |
throws_ok { $suggestion->budgetid($nonexistent_borrowernumber)->store; } |
182 |
{ # hide useless warnings |
162 |
'Koha::Exceptions::Object::FKConstraint', |
183 |
local *STDERR; |
163 |
'store raises an exception on invalid budgetid'; |
184 |
open STDERR, '>', '/dev/null'; |
|
|
185 |
|
186 |
throws_ok { $suggestion->budgetid($nonexistent_borrowernumber)->store; } |
187 |
'Koha::Exceptions::Object::FKConstraint', |
188 |
'store raises an exception on invalid budgetid'; |
189 |
close STDERR; |
190 |
} |
164 |
my $fund = $builder->build_object( { class => "Koha::Acquisition::Funds" } ); |
191 |
my $fund = $builder->build_object( { class => "Koha::Acquisition::Funds" } ); |
165 |
$suggestion->budgetid( $fund->id )->store; |
192 |
$suggestion->budgetid( $fund->id )->store; |
166 |
$fund->delete; |
193 |
$fund->delete; |
167 |
- |
|
|