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

(-)a/t/db_dependent/Koha/Acquisition/Orders.t (-4 / +30 lines)
Lines 36-41 subtest 'filter_by_active() tests' => sub { Link Here
36
36
37
    $schema->storage->txn_begin;
37
    $schema->storage->txn_begin;
38
38
39
    my $basket_1 = $builder->build_object(
40
        {
41
            class => 'Koha::Acquisition::Baskets',
42
            value => { is_standing => 1 }
43
        }
44
    );
45
46
    my $basket_2 = $builder->build_object(
47
        {
48
            class => 'Koha::Acquisition::Baskets',
49
            value => { is_standing => 0 }
50
        }
51
    );
52
39
    my $order_1 = $builder->build_object(
53
    my $order_1 = $builder->build_object(
40
        {
54
        {
41
            class => 'Koha::Acquisition::Orders',
55
            class => 'Koha::Acquisition::Orders',
Lines 51-57 subtest 'filter_by_active() tests' => sub { Link Here
51
    my $order_3 = $builder->build_object(
65
    my $order_3 = $builder->build_object(
52
        {
66
        {
53
            class => 'Koha::Acquisition::Orders',
67
            class => 'Koha::Acquisition::Orders',
54
            value => { orderstatus => 'new' }
68
            value => {
69
                basketno    => $basket_1->basketno,
70
                orderstatus => 'new'
71
            }
55
        }
72
        }
56
    );
73
    );
57
    my $order_4 = $builder->build_object(
74
    my $order_4 = $builder->build_object(
Lines 66-71 subtest 'filter_by_active() tests' => sub { Link Here
66
            value => { orderstatus => 'partial' }
83
            value => { orderstatus => 'partial' }
67
        }
84
        }
68
    );
85
    );
86
    my $order_6 = $builder->build_object(
87
        {
88
            class => 'Koha::Acquisition::Orders',
89
            value => {
90
                basketno    => $basket_2->basketno,
91
                orderstatus => 'new'
92
            }
93
        }
94
    );
69
95
70
    my $this_orders_rs = Koha::Acquisition::Orders->search(
96
    my $this_orders_rs = Koha::Acquisition::Orders->search(
71
        {
97
        {
Lines 75-80 subtest 'filter_by_active() tests' => sub { Link Here
75
                $order_3->ordernumber,
101
                $order_3->ordernumber,
76
                $order_4->ordernumber,
102
                $order_4->ordernumber,
77
                $order_5->ordernumber,
103
                $order_5->ordernumber,
104
                $order_6->ordernumber,
78
            ]
105
            ]
79
        },
106
        },
80
        {
107
        {
Lines 84-90 subtest 'filter_by_active() tests' => sub { Link Here
84
111
85
    my $rs = $this_orders_rs->filter_by_active;
112
    my $rs = $this_orders_rs->filter_by_active;
86
113
87
    is( $rs->count, 3, 'Only new, ordered and partial orders are returned' );
114
    is( $rs->count, 3, 'Only new (basket is standing), ordered and partial orders are returned' );
88
    is( $rs->next->ordernumber, $order_3->ordernumber , 'Expected order in resultset' );
115
    is( $rs->next->ordernumber, $order_3->ordernumber , 'Expected order in resultset' );
89
    is( $rs->next->ordernumber, $order_4->ordernumber , 'Expected order in resultset' );
116
    is( $rs->next->ordernumber, $order_4->ordernumber , 'Expected order in resultset' );
90
    is( $rs->next->ordernumber, $order_5->ordernumber , 'Expected order in resultset' );
117
    is( $rs->next->ordernumber, $order_5->ordernumber , 'Expected order in resultset' );
Lines 123-130 subtest 'filter_by_id_including_transfers() tests' => sub { Link Here
123
    $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_1->ordernumber });
150
    $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_1->ordernumber });
124
151
125
    is( $orders_rs->count, 2, 'The two referenced orders are returned' );
152
    is( $orders_rs->count, 2, 'The two referenced orders are returned' );
126
    is( $orders_rs->next->ordernumber, $order_2->ordernumber, 'The right order is returned' );
127
    is( $orders_rs->next->ordernumber, $order_1->ordernumber, 'The right order is returned' );
153
    is( $orders_rs->next->ordernumber, $order_1->ordernumber, 'The right order is returned' );
154
    is( $orders_rs->next->ordernumber, $order_2->ordernumber, 'The right order is returned' );
128
155
129
    $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_2->ordernumber });
156
    $orders_rs = $orders_rs->filter_by_id_including_transfers({ ordernumber => $order_2->ordernumber });
130
157
131
- 

Return to bug 25670