|
Lines 5-10
use Test::More tests => 3;
Link Here
|
| 5 |
use t::lib::TestBuilder; |
5 |
use t::lib::TestBuilder; |
| 6 |
use C4::Items qw( GetMarcItem ); |
6 |
use C4::Items qw( GetMarcItem ); |
| 7 |
|
7 |
|
|
|
8 |
use Koha::AuthorisedValues; |
| 8 |
use Koha::Caches; |
9 |
use Koha::Caches; |
| 9 |
use Koha::DateUtils qw( dt_from_string ); |
10 |
use Koha::DateUtils qw( dt_from_string ); |
| 10 |
|
11 |
|
|
Lines 26-48
subtest 'add_item_status' => sub {
Link Here
|
| 26 |
plan tests => 2; |
27 |
plan tests => 2; |
| 27 |
|
28 |
|
| 28 |
# This time we are sustituting some values |
29 |
# This time we are sustituting some values |
| 29 |
$builder->schema->resultset( 'AuthorisedValue' )->delete_all(); |
30 |
|
| 30 |
$builder->build({ |
31 |
my $available = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'AVAILABLE' }); |
| 31 |
source => 'AuthorisedValue', |
32 |
unless( $available ){ |
| 32 |
value => { |
33 |
$available = $builder->build_object({ |
| 33 |
category => 'Z3950_STATUS', |
34 |
class => 'Koha::AuthorisedValues', |
| 34 |
authorised_value => 'AVAILABLE', |
35 |
value => { |
| 35 |
lib => "Free as a bird" |
36 |
category => 'Z3950_STATUS', |
| 36 |
} |
37 |
authorised_value => 'AVAILABLE', |
| 37 |
}); |
38 |
lib => "Free as a bird" |
| 38 |
$builder->build({ |
39 |
} |
| 39 |
source => 'AuthorisedValue', |
40 |
}); |
| 40 |
value => { |
41 |
} |
| 41 |
category => 'Z3950_STATUS', |
42 |
my $available_status = $available->lib; |
| 42 |
authorised_value => 'DAMAGED', |
43 |
|
| 43 |
lib => "Borked completely" |
44 |
my $damaged = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'DAMAGED' }); |
| 44 |
} |
45 |
unless( $damaged ){ |
| 45 |
}); |
46 |
$damaged = $builder->build_object({ |
|
|
47 |
class => 'Koha::AuthorisedValues', |
| 48 |
value => { |
| 49 |
category => 'Z3950_STATUS', |
| 50 |
authorised_value => 'DAMAGED', |
| 51 |
lib => "Borked completely" |
| 52 |
} |
| 53 |
}); |
| 54 |
} |
| 55 |
my $damaged_status = $damaged->lib; |
| 46 |
|
56 |
|
| 47 |
## FIRST ITEM HAS ALL THE STATUSES ## |
57 |
## FIRST ITEM HAS ALL THE STATUSES ## |
| 48 |
my $item_1 = $builder->build_sample_item( |
58 |
my $item_1 = $builder->build_sample_item( |
|
Lines 82-91
subtest 'add_item_status' => sub {
Link Here
|
| 82 |
$zR->init_handler($args); |
92 |
$zR->init_handler($args); |
| 83 |
|
93 |
|
| 84 |
$args->{HANDLE}->add_item_status($item_field_1); |
94 |
$args->{HANDLE}->add_item_status($item_field_1); |
| 85 |
is($item_field_1->subfield('k'),"Checked Out, Lost, Not for Loan, Borked completely, Withdrawn, In Transit, On Hold","All statuses added in one field as expected"); |
95 |
is($item_field_1->subfield('k'),"Checked Out, Lost, Not for Loan, $damaged_status, Withdrawn, In Transit, On Hold","All statuses added in one field as expected"); |
| 86 |
|
96 |
|
| 87 |
$args->{HANDLE}->add_item_status($item_field_2); |
97 |
$args->{HANDLE}->add_item_status($item_field_2); |
| 88 |
is($item_field_2->subfield('k'),'Free as a bird',"Available status is 'Free as a bird' added as expected"); |
98 |
is($item_field_2->subfield('k'),"$available_status","Available status is '$available_status' added as expected"); |
| 89 |
|
99 |
|
| 90 |
}; |
100 |
}; |
| 91 |
|
101 |
|
| 92 |
- |
|
|