|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 14; |
22 |
use Test::More tests => 15; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
use Test::Warn; |
24 |
use Test::Warn; |
| 25 |
|
25 |
|
|
Lines 254-256
subtest '->is_paged and ->pager tests' => sub {
Link Here
|
| 254 |
|
254 |
|
| 255 |
$schema->storage->txn_rollback; |
255 |
$schema->storage->txn_rollback; |
| 256 |
}; |
256 |
}; |
| 257 |
- |
257 |
|
|
|
258 |
subtest '->search() tests' => sub { |
| 259 |
|
| 260 |
plan tests => 12; |
| 261 |
|
| 262 |
$schema->storage->txn_begin; |
| 263 |
|
| 264 |
Koha::Patrons->delete; |
| 265 |
|
| 266 |
# Create 10 patrons |
| 267 |
foreach (1..10) { |
| 268 |
$builder->build_object({ class => 'Koha::Patrons' }); |
| 269 |
} |
| 270 |
|
| 271 |
my $patrons = Koha::Patrons->search(); |
| 272 |
is( ref($patrons), 'Koha::Patrons', 'search in scalar context returns the Koha::Object-based type' ); |
| 273 |
my @patrons = Koha::Patrons->search(); |
| 274 |
is( scalar @patrons, 10, 'search in list context returns a list of objects' ); |
| 275 |
my $i = 0; |
| 276 |
foreach (1..10) { |
| 277 |
is( ref($patrons[$i]), 'Koha::Patron', 'Objects in the list have the singular type' ); |
| 278 |
$i++; |
| 279 |
} |
| 280 |
|
| 281 |
$schema->storage->txn_rollback; |
| 282 |
}; |