View | Details | Raw Unified | Return to bug 23414
Collapse All | Expand All

(-)a/t/db_dependent/XSLT.t (-11 / +29 lines)
Lines 20-26 use Modern::Perl; Link Here
20
use Test::More tests => 2;
20
use Test::More tests => 2;
21
use Test::Warn;
21
use Test::Warn;
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
use t::lib::Mocks;
23
24
25
use Koha::ItemTypes;
24
26
25
BEGIN {
27
BEGIN {
26
    use_ok('C4::XSLT');
28
    use_ok('C4::XSLT');
Lines 32-51 my $builder = t::lib::TestBuilder->new; Link Here
32
$schema->storage->txn_begin;
34
$schema->storage->txn_begin;
33
35
34
subtest 'buildKohaItemsNamespace status tests' => sub {
36
subtest 'buildKohaItemsNamespace status tests' => sub {
35
    plan tests => 10;
37
    plan tests => 12;
36
    my $item  = $builder->build_sample_item({
38
    my $item  = $builder->build_sample_item({});
37
    });
38
39
39
    my $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
40
    my $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
40
    like($xml,qr/<status>available<\/status>/,"Item is available when no other status applied");
41
    like($xml,qr/<status>available<\/status>/,"Item is available when no other status applied");
41
42
42
    $item->notforloan(-1)->store;
43
    # notforloan
43
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
44
    {
44
    like($xml,qr/<status>On order<\/status>/,"On order if negative notforloan value");
45
45
46
        t::lib::Mocks::mock_preference('item-level_itypes', 0);
46
    $item->notforloan(1)->store;
47
        $item->notforloan(0)->store;
47
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
48
        Koha::ItemTypes->find($item->itype)->notforloan(0)->store;
48
    like($xml,qr/<status>reference<\/status>/,"reference if positive notforloan value");
49
        Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(1)->store;
50
        $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
51
        like($xml,qr/<status>reference<\/status>/,"reference if positive itype notforloan value");
52
53
        t::lib::Mocks::mock_preference('item-level_itypes', 1);
54
        Koha::ItemTypes->find($item->itype)->notforloan(1)->store;
55
        Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(0)->store;
56
        $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
57
        like($xml,qr/<status>reference<\/status>/,"reference if positive itemtype notforloan value");
58
        Koha::ItemTypes->find($item->itype)->notforloan(0)->store;
59
60
        $item->notforloan(-1)->store;
61
        $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
62
        like($xml,qr/<status>On order<\/status>/,"On order if negative notforloan value");
63
64
        $item->notforloan(1)->store;
65
        $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
66
        like($xml,qr/<status>reference<\/status>/,"reference if positive notforloan value");
67
    }
49
68
50
    $item->onloan('2001-01-01')->store;
69
    $item->onloan('2001-01-01')->store;
51
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
70
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
52
- 

Return to bug 23414