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 |
|
10 |
|
10 |
BEGIN { |
11 |
BEGIN { |
Lines 25-47
subtest 'add_item_status' => sub {
Link Here
|
25 |
plan tests => 2; |
26 |
plan tests => 2; |
26 |
|
27 |
|
27 |
# This time we are sustituting some values |
28 |
# This time we are sustituting some values |
28 |
$builder->schema->resultset( 'AuthorisedValue' )->delete_all(); |
29 |
|
29 |
$builder->build({ |
30 |
my $available = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'AVAILABLE' }); |
30 |
source => 'AuthorisedValue', |
31 |
unless( $available ){ |
31 |
value => { |
32 |
$available = $builder->build_object({ |
32 |
category => 'Z3950_STATUS', |
33 |
class => 'Koha::AuthorisedValues', |
33 |
authorised_value => 'AVAILABLE', |
34 |
value => { |
34 |
lib => "Free as a bird" |
35 |
category => 'Z3950_STATUS', |
35 |
} |
36 |
authorised_value => 'AVAILABLE', |
36 |
}); |
37 |
lib => "Free as a bird" |
37 |
$builder->build({ |
38 |
} |
38 |
source => 'AuthorisedValue', |
39 |
}); |
39 |
value => { |
40 |
} |
40 |
category => 'Z3950_STATUS', |
41 |
my $available_status = $available->lib; |
41 |
authorised_value => 'DAMAGED', |
42 |
|
42 |
lib => "Borked completely" |
43 |
my $damaged = Koha::AuthorisedValues->find({ category => 'Z3950_STATUS', authorised_value => 'DAMAGED' }); |
43 |
} |
44 |
unless( $damaged ){ |
44 |
}); |
45 |
$damaged = $builder->build_object({ |
|
|
46 |
class => 'Koha::AuthorisedValues', |
47 |
value => { |
48 |
category => 'Z3950_STATUS', |
49 |
authorised_value => 'DAMAGED', |
50 |
lib => "Borked completely" |
51 |
} |
52 |
}); |
53 |
} |
54 |
my $damaged_status = $damaged->lib; |
45 |
|
55 |
|
46 |
## FIRST ITEM HAS ALL THE STATUSES ## |
56 |
## FIRST ITEM HAS ALL THE STATUSES ## |
47 |
my $item_1 = $builder->build_sample_item( |
57 |
my $item_1 = $builder->build_sample_item( |
Lines 81-90
subtest 'add_item_status' => sub {
Link Here
|
81 |
$zR->init_handler($args); |
91 |
$zR->init_handler($args); |
82 |
|
92 |
|
83 |
$args->{HANDLE}->add_item_status($item_field_1); |
93 |
$args->{HANDLE}->add_item_status($item_field_1); |
84 |
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"); |
94 |
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"); |
85 |
|
95 |
|
86 |
$args->{HANDLE}->add_item_status($item_field_2); |
96 |
$args->{HANDLE}->add_item_status($item_field_2); |
87 |
is($item_field_2->subfield('k'),'Free as a bird',"Available status is 'Free as a bird' added as expected"); |
97 |
is($item_field_2->subfield('k'),"$available_status","Available status is '$available_status' added as expected"); |
88 |
|
98 |
|
89 |
}; |
99 |
}; |
90 |
|
100 |
|
91 |
- |
|
|