3 use Test::More tests => 13;
7 use_ok 'Support::TestSetup';
8 use_ok 'SL::Controller::Helper::ParseFilter';
10 Support::TestSetup::login();
11 my ($filter, $expected);
14 my $got = { parse_filter($_[0]) };
20 print STDERR "expected => ", Dumper($_[1]), "\ngot: => ", Dumper($got), $/;
42 query => [ 'customer.name' => 'rainer' ],
43 with_objects => [ 'customer' ],
44 }, 'joining customers';
53 query => [ 'customer.chart.accno' => 'test' ],
54 with_objects => bag( 'customer', 'chart' ),
58 'customer:substr' => 'Meyer'
60 query => [ customer => '%Meyer%' ]
61 }, 'simple filter substr';
64 'customer::ilike' => 'Meyer'
66 query => [ customer => { ilike => 'Meyer' } ]
67 }, 'simple method ilike';
72 'accno:tail::like' => '1200'
77 query => [ 'customer.chart.accno' => { like => '%1200' } ],
78 with_objects => bag('customer', 'chart' ),
93 'invoice.customer.name' => 'test',
94 'customer.name' => 'test',
96 'with_objects' => bag( 'invoice', 'customer' )
97 }, 'object in more than one relationship';
100 'orddate:date::' => 'lt',
101 'orddate:date' => '20.3.2010',
104 'orddate' => { 'lt' => isa('DateTime') }
107 }, 'method dispatch and date constructor';
114 query => [ id => [ 123,125,157 ] ],
115 }, 'arrays as value';
118 'sellprice:number' => [
119 '123,4', '2,34', '0,4',
123 sellprice => [ 123.4, 2.34, 0.4 ],
125 }, 'arrays with filter';