|
Lines 137-143
subtest 'list() tests' => sub {
Link Here
|
| 137 |
|
137 |
|
| 138 |
subtest 'sorting tests' => sub { |
138 |
subtest 'sorting tests' => sub { |
| 139 |
|
139 |
|
| 140 |
plan tests => 10; |
140 |
plan tests => 14; |
| 141 |
|
141 |
|
| 142 |
$schema->storage->txn_begin; |
142 |
$schema->storage->txn_begin; |
| 143 |
|
143 |
|
|
Lines 188-193
subtest 'list() tests' => sub {
Link Here
|
| 188 |
is( $result->[0]->{order_id}, $order_2->id, 'The first element is order_2' ); |
188 |
is( $result->[0]->{order_id}, $order_2->id, 'The first element is order_2' ); |
| 189 |
is( $result->[1]->{order_id}, $order_1->id, 'The second element is order_1' ); |
189 |
is( $result->[1]->{order_id}, $order_1->id, 'The second element is order_1' ); |
| 190 |
|
190 |
|
|
|
191 |
$biblio_1->biblioitem->set( |
| 192 |
{ |
| 193 |
isbn => 'A', |
| 194 |
ean => 'Y', |
| 195 |
publishercode => 'M', |
| 196 |
} |
| 197 |
)->store; |
| 198 |
|
| 199 |
$biblio_2->biblioitem->set( |
| 200 |
{ |
| 201 |
isbn => 'B', |
| 202 |
ean => 'X', |
| 203 |
publishercode => 'L', |
| 204 |
} |
| 205 |
)->store; |
| 206 |
|
| 207 |
$result = |
| 208 |
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_order_by=-biblio.isbn,+biblio.ean,-biblio.publisher&basket_id=" . $basket->id => {'x-koha-embed' => 'biblio'} ) |
| 209 |
->status_is( 200, "query successful" ) |
| 210 |
->tx->res->json; |
| 211 |
|
| 212 |
is( $result->[0]->{order_id}, $order_2->id, 'Ordered correctly' ); |
| 213 |
is( $result->[1]->{order_id}, $order_1->id, 'Ordered correctly' ); |
| 214 |
|
| 191 |
$schema->storage->txn_rollback; |
215 |
$schema->storage->txn_rollback; |
| 192 |
}; |
216 |
}; |
| 193 |
|
217 |
|
| 194 |
- |
|
|