|
Lines 80-85
get '/biblios' => sub {
Link Here
|
| 80 |
use Test::More tests => 9; |
80 |
use Test::More tests => 9; |
| 81 |
use Test::Mojo; |
81 |
use Test::Mojo; |
| 82 |
|
82 |
|
|
|
83 |
use t::lib::Mocks; |
| 83 |
use t::lib::TestBuilder; |
84 |
use t::lib::TestBuilder; |
| 84 |
use Koha::Database; |
85 |
use Koha::Database; |
| 85 |
|
86 |
|
|
Lines 90-96
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 90 |
|
91 |
|
| 91 |
subtest 'objects.search helper' => sub { |
92 |
subtest 'objects.search helper' => sub { |
| 92 |
|
93 |
|
| 93 |
plan tests => 38; |
94 |
plan tests => 44; |
| 94 |
|
95 |
|
| 95 |
$schema->storage->txn_begin; |
96 |
$schema->storage->txn_begin; |
| 96 |
|
97 |
|
|
Lines 172-177
subtest 'objects.search helper' => sub {
Link Here
|
| 172 |
->json_is('/2/name' => 'Manuelab') |
173 |
->json_is('/2/name' => 'Manuelab') |
| 173 |
->json_is('/3/name' => 'Emanuel'); |
174 |
->json_is('/3/name' => 'Emanuel'); |
| 174 |
|
175 |
|
|
|
176 |
# Add 20 more cities |
| 177 |
for ( 1..20 ) { |
| 178 |
$builder->build_object({ class => 'Koha::Cities' }); |
| 179 |
} |
| 180 |
|
| 181 |
t::lib::Mocks::mock_preference('RESTdefaultPageSize', 20 ); |
| 182 |
$t->get_ok('/cities') |
| 183 |
->status_is(200); |
| 184 |
|
| 185 |
my $response_count = scalar @{ $t->tx->res->json }; |
| 186 |
is( $response_count, 20, 'RESTdefaultPageSize is honoured by default (20)' ); |
| 187 |
|
| 188 |
t::lib::Mocks::mock_preference('RESTdefaultPageSize', 5 ); |
| 189 |
$t->get_ok('/cities') |
| 190 |
->status_is(200); |
| 191 |
|
| 192 |
$response_count = scalar @{ $t->tx->res->json }; |
| 193 |
is( $response_count, 5, 'RESTdefaultPageSize is honoured by default (5)' ); |
| 194 |
|
| 175 |
$schema->storage->txn_rollback; |
195 |
$schema->storage->txn_rollback; |
| 176 |
}; |
196 |
}; |
| 177 |
|
197 |
|
|
Lines 363-366
subtest 'object.search helper order by embedded columns' => sub {
Link Here
|
| 363 |
->json_is('/biblios/1/biblio_id' => $biblio1->biblionumber, 'Biblio 1 should be second'); |
383 |
->json_is('/biblios/1/biblio_id' => $biblio1->biblionumber, 'Biblio 1 should be second'); |
| 364 |
|
384 |
|
| 365 |
$schema->storage->txn_begin; |
385 |
$schema->storage->txn_begin; |
| 366 |
} |
386 |
} |
| 367 |
- |
|
|