Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 84c2b3f2

Von Sven Schöling vor mehr als 9 Jahren hinzugefügt

  • ID 84c2b3f270aa65978d03f82cde8136f6764406a2
  • Vorgänger f4051b8f
  • Nachfolger e73ff77b

ParseFilter: typo + test

Unterschiede anzeigen:

SL/Controller/Helper/ParseFilter.pm
151 151
  my @tokens     = split /\./, $key;
152 152
  my $curr_class = $class->object_class;
153 153

  
154
  # find first token which is not a relationship
154
  # our key will consist of dot-delimited tokens
155
  # like this: order.part.unit.name
156
  # each of these tokens except the last one is one of:
157
  #  - a relationship in the parent object
158
  #  - a custom filter
159
  #
160
  # the last token must be
161
  #  - a custom filter
162
  #  - a column in the parent object
163
  #
164
  # find first token which is not a relationship,
165
  # so we can pass the rest on
155 166
  my $i = 0;
156 167
   while ($i < $#tokens) {
157 168
    eval {
158
      $curr_class = $curr_class->meta->relationship($tokens[$_])->class;
169
      $curr_class = $curr_class->meta->relationship($tokens[$i])->class;
159 170
      ++$i;
160 171
    } or do {
161 172
      last;
t/controllers/helpers/parse_filter.t
1 1
use lib 't';
2 2

  
3
use Test::More tests => 36;
3
use Test::More tests => 37;
4 4
use Test::Deep;
5 5
use Data::Dumper;
6 6

  
......
397 397
    'part.test' => { 'what', { ilike => '%2%' } },
398 398
  ]
399 399
}, 'additional tokens + filters + methods', class => 'SL::DB::Manager::OrderItem';
400

  
401
test {
402
  'orderitems.part.test.what:substr::ilike' => 2,
403
}, {
404
  query => [
405
    'orderitems.part.test' => { 'what', { ilike => '%2%' } },
406
  ]
407
}, 'relationship + additional tokens + filters + methods', class => 'SL::DB::Manager::Order';

Auch abrufbar als: Unified diff