1 |
1 |
use lib 't';
|
2 |
2 |
|
3 |
|
use Test::More tests => 31;
|
|
3 |
use Test::More tests => 36;
|
4 |
4 |
use Test::Deep;
|
5 |
5 |
use Data::Dumper;
|
6 |
6 |
|
... | ... | |
179 |
179 |
}
|
180 |
180 |
}, 'deep laundering, check for laundered hash', target => 'launder', launder_to => { };
|
181 |
181 |
|
|
182 |
test {
|
|
183 |
part => {
|
|
184 |
'sellprice:number' => '2',
|
|
185 |
'sellprice:number::' => 'le',
|
|
186 |
}
|
|
187 |
}, {
|
|
188 |
part => {
|
|
189 |
'sellprice:number' => '2',
|
|
190 |
'sellprice:number::' => 'le',
|
|
191 |
}
|
|
192 |
}, 'laundering of indirect filters does not alter', target => 'filter', launder_to => { };
|
|
193 |
|
|
194 |
test {
|
|
195 |
part => {
|
|
196 |
'sellprice:number' => '2',
|
|
197 |
'sellprice:number::' => 'le',
|
|
198 |
}
|
|
199 |
}, {
|
|
200 |
part => {
|
|
201 |
'sellprice_number' => '2',
|
|
202 |
'sellprice_number__' => 'le',
|
|
203 |
}
|
|
204 |
}, 'laundering of indirect filters', target => 'launder', launder_to => { };
|
|
205 |
|
|
206 |
test {
|
|
207 |
part => {
|
|
208 |
'sellprice:number' => '2',
|
|
209 |
'sellprice:number::' => 'le',
|
|
210 |
}
|
|
211 |
}, {
|
|
212 |
part => {
|
|
213 |
'sellprice:number' => '2',
|
|
214 |
'sellprice:number::' => 'le',
|
|
215 |
'sellprice_number' => '2',
|
|
216 |
'sellprice_number__' => 'le',
|
|
217 |
}
|
|
218 |
}, 'laundering of indirect filters - inplace', target => 'filter';
|
|
219 |
|
182 |
220 |
### bug: sub objects
|
183 |
221 |
|
184 |
222 |
test {
|
... | ... | |
335 |
373 |
]
|
336 |
374 |
]
|
337 |
375 |
}, ':multi with complex tokenizing';
|
|
376 |
|
|
377 |
# test tokenizing for custom filters by monkeypatching a custom filter into Part
|
|
378 |
SL::DB::Manager::Part->add_filter_specs(
|
|
379 |
test => sub {
|
|
380 |
my ($key, $value, $prefix, @additional) = @_;
|
|
381 |
return "$prefix$key" => { @additional, $value };
|
|
382 |
}
|
|
383 |
);
|
|
384 |
|
|
385 |
test {
|
|
386 |
'part.test.what' => 2,
|
|
387 |
}, {
|
|
388 |
query => [
|
|
389 |
'part.test' => { 'what', 2 },
|
|
390 |
]
|
|
391 |
}, 'additional tokens', class => 'SL::DB::Manager::OrderItem';
|
|
392 |
|
|
393 |
test {
|
|
394 |
'part.test.what:substr::ilike' => 2,
|
|
395 |
}, {
|
|
396 |
query => [
|
|
397 |
'part.test' => { 'what', { ilike => '%2%' } },
|
|
398 |
]
|
|
399 |
}, 'additional tokens + filters + methods', class => 'SL::DB::Manager::OrderItem';
|
ParseFilter: Laundern schon vor dem eigentlichen parsen.
Erlaubt es indirekte Filter im Template roundtrip safe zu machen.