Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 15; |
22 |
use Test::More tests => 14; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
25 |
|
25 |
|
Lines 95-104
subtest 'delete' => sub {
Link Here
|
95 |
is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->count, 0, ''); |
95 |
is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->count, 0, ''); |
96 |
}; |
96 |
}; |
97 |
|
97 |
|
98 |
subtest 'not_covered_yet' => sub { |
|
|
99 |
plan tests => 1; |
100 |
warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; |
101 |
}; |
102 |
subtest 'new' => sub { |
98 |
subtest 'new' => sub { |
103 |
plan tests => 2; |
99 |
plan tests => 2; |
104 |
my $a_cat_code = 'A_CAT_CODE'; |
100 |
my $a_cat_code = 'A_CAT_CODE'; |
Lines 188-203
subtest 'get_column' => sub {
Link Here
|
188 |
}; |
184 |
}; |
189 |
|
185 |
|
190 |
subtest 'Exceptions' => sub { |
186 |
subtest 'Exceptions' => sub { |
191 |
plan tests => 2; |
187 |
plan tests => 7; |
192 |
|
188 |
|
193 |
my $patron_borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
189 |
my $patron_borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber }; |
194 |
my $patron = Koha::Patrons->find( $patron_borrowernumber ); |
190 |
my $patron = Koha::Patrons->find( $patron_borrowernumber ); |
195 |
|
191 |
|
|
|
192 |
# Koha::Object |
196 |
try { |
193 |
try { |
197 |
$patron->blah('blah'); |
194 |
$patron->blah('blah'); |
198 |
} catch { |
195 |
} catch { |
199 |
ok( $_->isa('Koha::Exceptions::Object::MethodNotCoveredByTests'), |
196 |
ok( $_->isa('Koha::Exceptions::Object::MethodNotCoveredByTests'), |
200 |
'Calling a non-covered method should raise a Koha::Exceptions::Object::MethodNotCoveredByTests exception' ); |
197 |
'Calling a non-covered method should raise a Koha::Exceptions::Object::MethodNotCoveredByTests exception' ); |
|
|
198 |
is( $_->message, 'The method Koha::Patron->blah is not covered by tests!', 'The message raised should contain the package and the method' ); |
201 |
}; |
199 |
}; |
202 |
|
200 |
|
203 |
try { |
201 |
try { |
Lines 206-211
subtest 'Exceptions' => sub {
Link Here
|
206 |
ok( $_->isa('Koha::Exceptions::Object::PropertyNotFound'), |
204 |
ok( $_->isa('Koha::Exceptions::Object::PropertyNotFound'), |
207 |
'Setting a non-existent property should raise a Koha::Exceptions::Object::PropertyNotFound exception' ); |
205 |
'Setting a non-existent property should raise a Koha::Exceptions::Object::PropertyNotFound exception' ); |
208 |
}; |
206 |
}; |
|
|
207 |
|
208 |
# Koha::Objects |
209 |
try { |
210 |
Koha::Patrons->search->not_covered_yet; |
211 |
} catch { |
212 |
ok( $_->isa('Koha::Exceptions::Object::MethodNotCoveredByTests'), |
213 |
'Calling a non-covered method should raise a Koha::Exceptions::Object::MethodNotCoveredByTests exception' ); |
214 |
is( $_->message, 'The method Koha::Patrons->not_covered_yet is not covered by tests!', 'The message raised should contain the package and the method' ); |
215 |
}; |
216 |
|
217 |
try { |
218 |
Koha::Patrons->not_covered_yet; |
219 |
} catch { |
220 |
ok( $_->isa('Koha::Exceptions::Object::MethodNotCoveredByTests'), |
221 |
'Calling a non-covered method should raise a Koha::Exceptions::Object::MethodNotCoveredByTests exception' ); |
222 |
is( $_->message, 'The method Koha::Patrons->not_covered_yet is not covered by tests!', 'The message raised should contain the package and the method' ); |
223 |
}; |
209 |
}; |
224 |
}; |
210 |
|
225 |
|
211 |
$schema->storage->txn_rollback; |
226 |
$schema->storage->txn_rollback; |
212 |
- |
|
|