Lines 326-332
subtest 'objects.search helper, encoding' => sub {
Link Here
|
326 |
$builder->build_object({ class => 'Koha::Cities', value => { city_name => 'B', city_country => '❤Argentina❤' } }); |
326 |
$builder->build_object({ class => 'Koha::Cities', value => { city_name => 'B', city_country => '❤Argentina❤' } }); |
327 |
|
327 |
|
328 |
my $t = Test::Mojo->new; |
328 |
my $t = Test::Mojo->new; |
329 |
$t->get_ok('/cities?q={"country": "❤Argentina❤"}') |
329 |
$t->get_ok('/cities?q={"country": "❤Argentina❤"}&q=[]') |
330 |
->status_is(200) |
330 |
->status_is(200) |
331 |
->json_has('/0') |
331 |
->json_has('/0') |
332 |
->json_hasnt('/1') |
332 |
->json_hasnt('/1') |
Lines 424-433
subtest 'object.search helper with q parameter' => sub {
Link Here
|
424 |
my $suggestion3 = $builder->build_object( { class => "Koha::Suggestions", value => { suggestedby => $patron2->borrowernumber, biblionumber => $biblio3->biblionumber} } ); |
424 |
my $suggestion3 = $builder->build_object( { class => "Koha::Suggestions", value => { suggestedby => $patron2->borrowernumber, biblionumber => $biblio3->biblionumber} } ); |
425 |
|
425 |
|
426 |
my $t = Test::Mojo->new; |
426 |
my $t = Test::Mojo->new; |
427 |
$t->get_ok('/biblios?q={"suggestions.suggester.patron_id": "'.$patron1->borrowernumber.'"}') |
427 |
$t->get_ok('/biblios?q={"suggestions.suggester.patron_id": "'.$patron1->borrowernumber.'"}&q=[]') |
428 |
->json_is('/count' => 1, 'there should be 1 biblio with suggestions of patron 1'); |
428 |
->json_is('/count' => 1, 'there should be 1 biblio with suggestions of patron 1'); |
429 |
|
429 |
|
430 |
$t->get_ok('/biblios?q={"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}') |
430 |
$t->get_ok('/biblios?q={"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}&q=[]') |
431 |
->json_is('/count' => 2, 'there should be 2 biblios with suggestions of patron 2'); |
431 |
->json_is('/count' => 2, 'there should be 2 biblios with suggestions of patron 2'); |
432 |
|
432 |
|
433 |
$schema->storage->txn_rollback; |
433 |
$schema->storage->txn_rollback; |
Lines 472-484
subtest 'object.search helper with all query methods' => sub {
Link Here
|
472 |
my $suggestion3 = $builder->build_object( { class => "Koha::Suggestions", value => { suggestedby => $patron2->borrowernumber, biblionumber => $biblio3->biblionumber} } ); |
472 |
my $suggestion3 = $builder->build_object( { class => "Koha::Suggestions", value => { suggestedby => $patron2->borrowernumber, biblionumber => $biblio3->biblionumber} } ); |
473 |
|
473 |
|
474 |
my $t = Test::Mojo->new; |
474 |
my $t = Test::Mojo->new; |
475 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron1->firstname.'"}' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron1->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron1->cardnumber}) |
475 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron1->firstname.'"}&q=[]' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron1->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron1->cardnumber}) |
476 |
->json_is('/count' => 1, 'there should be 1 biblio with suggestions of patron 1'); |
476 |
->json_is('/count' => 1, 'there should be 1 biblio with suggestions of patron 1'); |
477 |
|
477 |
|
478 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron2->firstname.'"}' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron2->cardnumber}) |
478 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron2->firstname.'"}&q=[]' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron2->cardnumber}) |
479 |
->json_is('/count' => 2, 'there should be 2 biblios with suggestions of patron 2'); |
479 |
->json_is('/count' => 2, 'there should be 2 biblios with suggestions of patron 2'); |
480 |
|
480 |
|
481 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron1->firstname.'"}' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron2->cardnumber}) |
481 |
$t->get_ok('/biblios?q={"suggestions.suggester.firstname": "'.$patron1->firstname.'"}&q=[]' => {'x-koha-query' => '{"suggestions.suggester.patron_id": "'.$patron2->borrowernumber.'"}'} => json => {"suggestions.suggester.cardnumber" => $patron2->cardnumber}) |
482 |
->json_is('/count' => 0, 'there shouldn\'t be biblios where suggester has patron1 fistname and patron2 id'); |
482 |
->json_is('/count' => 0, 'there shouldn\'t be biblios where suggester has patron1 fistname and patron2 id'); |
483 |
|
483 |
|
484 |
$schema->storage->txn_rollback; |
484 |
$schema->storage->txn_rollback; |
485 |
- |
|
|