|
Lines 19-27
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 2; |
22 |
use Test::More tests => 3; |
| 23 |
|
23 |
|
| 24 |
use Koha::Authority::Types; |
24 |
use Koha::Authority::Types; |
|
|
25 |
use Koha::Patron::Category; |
| 26 |
use Koha::Patron::Categories; |
| 25 |
use Koha::Patrons; |
27 |
use Koha::Patrons; |
| 26 |
use Koha::Database; |
28 |
use Koha::Database; |
| 27 |
|
29 |
|
|
Lines 36-40
my @columns = Koha::Patrons->columns;
Link Here
|
| 36 |
my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns; |
38 |
my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns; |
| 37 |
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' ); |
39 |
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' ); |
| 38 |
|
40 |
|
|
|
41 |
subtest 'new' => sub { |
| 42 |
plan tests => 2; |
| 43 |
my $a_cat_code = 'A_CAT_CODE'; |
| 44 |
my $patron_category = Koha::Patron::Category->new( { categorycode => $a_cat_code } )->store; |
| 45 |
is( Koha::Patron::Categories->find($a_cat_code)->category_type, 'A', 'Koha::Object->new should set the default value' ); |
| 46 |
Koha::Patron::Categories->find($a_cat_code)->delete; |
| 47 |
$patron_category = Koha::Patron::Category->new( { categorycode => $a_cat_code, category_type => undef } )->store; |
| 48 |
is( Koha::Patron::Categories->find($a_cat_code)->category_type, 'A', 'Koha::Object->new should set the default value even if the argument exists but is not defined' ); |
| 49 |
Koha::Patron::Categories->find($a_cat_code)->delete; |
| 50 |
}; |
| 51 |
|
| 39 |
$schema->storage->txn_rollback; |
52 |
$schema->storage->txn_rollback; |
| 40 |
1; |
53 |
1; |
| 41 |
- |
|
|