X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fcontrollers%2Fhelpers%2Fparse_filter.t;h=9d003c0453e55552f0a1d92e49c147e98ea8f303;hb=41b9f5c7c8067d67326c83e2d26df0898bc279ca;hp=179c236c9f914f0993e477a55bad5d450f05b14f;hpb=e5fdc4f27f18beeffbb1510f2fa6ee545087ea49;p=kivitendo-erp.git diff --git a/t/controllers/helpers/parse_filter.t b/t/controllers/helpers/parse_filter.t index 179c236c9..9d003c045 100644 --- a/t/controllers/helpers/parse_filter.t +++ b/t/controllers/helpers/parse_filter.t @@ -1,6 +1,6 @@ use lib 't'; -use Test::More tests => 17; +use Test::More tests => 18; use Test::Deep; use Data::Dumper; @@ -16,7 +16,7 @@ sub test ($$$;%) { my ($filter, $expect, $msg, %params) = @_; my $target = delete $params{target}; my $args = { parse_filter($filter, %params) }; - my $got = $args; + my $got = $args; $target ||= ''; $got = $filter if $target =~ /filter/; $got = $params{launder_to} if $target =~ /launder/; cmp_deeply( @@ -58,7 +58,7 @@ test { } }, { query => [ 'customer.chart.accno' => 'test' ], - with_objects => bag( 'customer', 'chart' ), + with_objects => bag( 'customer', 'customer.chart' ), }, 'nested joins'; test { @@ -82,7 +82,7 @@ test { }, { query => [ 'customer.chart.accno' => { like => '%1200' } ], - with_objects => bag('customer', 'chart' ), + with_objects => bag('customer', 'customer.chart' ), }, 'all together'; @@ -100,7 +100,7 @@ test { 'invoice.customer.name' => 'test', 'customer.name' => 'test', }} ], - 'with_objects' => bag( 'invoice', 'customer' ) + 'with_objects' => bag( 'invoice.customer', 'customer', 'invoice' ) }, 'object in more than one relationship'; test { @@ -177,3 +177,16 @@ test { } }, 'deep laundering, check for laundered hash', target => 'launder', launder_to => { }; +### bug: sub objects + +test { + order => { + customer => { + 'name:substr::ilike' => 'test', + } + } +}, { + query => [ 'order.customer.name' => { ilike => '%test%' } ], + with_objects => bag('order.customer', 'order'), +}, 'sub objects have to retain their prefix'; +