Lines 22-34
use Koha::Database;
Link Here
|
22 |
use Koha::Illrequestattributes; |
22 |
use Koha::Illrequestattributes; |
23 |
use Koha::Illrequest::Config; |
23 |
use Koha::Illrequest::Config; |
24 |
use Koha::Patrons; |
24 |
use Koha::Patrons; |
|
|
25 |
use Koha::AuthorisedValueCategories; |
26 |
use Koha::AuthorisedValues; |
25 |
use t::lib::Mocks; |
27 |
use t::lib::Mocks; |
26 |
use t::lib::TestBuilder; |
28 |
use t::lib::TestBuilder; |
27 |
use Test::MockObject; |
29 |
use Test::MockObject; |
28 |
use Test::MockModule; |
30 |
use Test::MockModule; |
29 |
use Test::Exception; |
31 |
use Test::Exception; |
30 |
|
32 |
|
31 |
use Test::More tests => 10; |
33 |
use Test::More tests => 11; |
32 |
|
34 |
|
33 |
my $schema = Koha::Database->new->schema; |
35 |
my $schema = Koha::Database->new->schema; |
34 |
my $builder = t::lib::TestBuilder->new; |
36 |
my $builder = t::lib::TestBuilder->new; |
Lines 795-797
subtest 'Checking Limits' => sub {
Link Here
|
795 |
|
797 |
|
796 |
$schema->storage->txn_rollback; |
798 |
$schema->storage->txn_rollback; |
797 |
}; |
799 |
}; |
798 |
- |
800 |
|
|
|
801 |
subtest 'Custom statuses' => sub { |
802 |
|
803 |
plan tests => 3; |
804 |
|
805 |
$schema->storage->txn_begin; |
806 |
|
807 |
my $cat = Koha::AuthorisedValueCategories->search( |
808 |
{ |
809 |
category_name => 'ILLSTATUS' |
810 |
} |
811 |
); |
812 |
|
813 |
if ($cat->count == 0) { |
814 |
$cat = $builder->build_object( |
815 |
{ |
816 |
class => 'Koha::AuthorisedValueCategory', |
817 |
value => { |
818 |
category_name => 'ILLSTATUS' |
819 |
} |
820 |
} |
821 |
); |
822 |
}; |
823 |
|
824 |
my $av = $builder->build_object( |
825 |
{ |
826 |
class => 'Koha::AuthorisedValues', |
827 |
value => { |
828 |
category => 'ILLSTATUS' |
829 |
} |
830 |
} |
831 |
); |
832 |
|
833 |
is($av->category, 'ILLSTATUS', |
834 |
"Successfully created authorised value for custom status"); |
835 |
|
836 |
my $ill_req = $builder->build_object( |
837 |
{ |
838 |
class => 'Koha::Illrequests', |
839 |
value => { |
840 |
status_alias => $av->id |
841 |
} |
842 |
} |
843 |
); |
844 |
isa_ok($ill_req->statusalias, 'Koha::AuthorisedValue', |
845 |
"statusalias correctly returning Koha::AuthorisedValue object"); |
846 |
|
847 |
$ill_req->status("COMP"); |
848 |
is($ill_req->statusalias, undef, |
849 |
"Koha::Illrequest->status overloading resetting status_alias"); |
850 |
|
851 |
$schema->storage->txn_rollback; |
852 |
}; |