|
Lines 189-201
subtest 'objects.search helper, embed' => sub {
Link Here
|
| 189 |
}; |
189 |
}; |
| 190 |
|
190 |
|
| 191 |
subtest 'objects.search helper, with path parameters and _match' => sub { |
191 |
subtest 'objects.search helper, with path parameters and _match' => sub { |
| 192 |
plan tests => 4; |
192 |
plan tests => 8; |
| 193 |
|
193 |
|
| 194 |
$schema->storage->txn_begin; |
194 |
$schema->storage->txn_begin; |
| 195 |
|
195 |
|
| 196 |
Koha::Holds->search()->delete; |
196 |
Koha::Holds->search()->delete; |
| 197 |
|
197 |
|
| 198 |
$builder->build_object({class=>"Koha::Holds", value => {borrowernumber => 10 }}); |
198 |
my $patron = Koha::Patrons->find(10); |
|
|
199 |
$patron->delete if $patron; |
| 200 |
$patron = $builder->build_object( { class => "Koha::Patrons" } ); |
| 201 |
$patron->borrowernumber(10)->store; |
| 202 |
$builder->build_object( |
| 203 |
{ |
| 204 |
class => "Koha::Holds", |
| 205 |
value => { borrowernumber => $patron->borrowernumber } |
| 206 |
} |
| 207 |
); |
| 199 |
|
208 |
|
| 200 |
$t->get_ok('/patrons/1/holds?_match=exact') |
209 |
$t->get_ok('/patrons/1/holds?_match=exact') |
| 201 |
->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=exact'); |
210 |
->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=exact'); |
|
Lines 203-207
subtest 'objects.search helper, with path parameters and _match' => sub {
Link Here
|
| 203 |
$t->get_ok('/patrons/1/holds?_match=contains') |
212 |
$t->get_ok('/patrons/1/holds?_match=contains') |
| 204 |
->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=contains'); |
213 |
->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=contains'); |
| 205 |
|
214 |
|
|
|
215 |
$t->get_ok('/patrons/10/holds?_match=exact') |
| 216 |
->json_is('/count' => 1, 'there should be 1 hold for borrower 10 with _match=exact'); |
| 217 |
|
| 218 |
$t->get_ok('/patrons/10/holds?_match=contains') |
| 219 |
->json_is('/count' => 1, 'there should be 1 hold for borrower 10 with _match=contains'); |
| 220 |
|
| 206 |
$schema->storage->txn_rollback; |
221 |
$schema->storage->txn_rollback; |
| 207 |
}; |
222 |
}; |
| 208 |
- |
|
|