Revision c51a1ebc
Von Sven Schöling vor etwa 2 Jahren hinzugefügt
| SL/DB/Manager/PriceRuleItem.pm | ||
|---|---|---|
|   { type => 'qty',        description => t8('Qty'),                customer => 1, vendor => 1, data_type => 'num',  data => sub { $_[1]->qty }, ops => 'num' },
 | ||
| );
 | ||
|  | ||
| # text, textfield, htmlfield, bool are not supported
 | ||
| our %price_rule_type_by_cvar_type = (
 | ||
|   select    => 'text',
 | ||
|   customer  => 'int',
 | ||
|   vendor    => 'int',
 | ||
|   part      => 'int',
 | ||
|   number    => 'num',
 | ||
|   date      => 'date',
 | ||
|   text      => undef,
 | ||
|   textfield => undef,
 | ||
|   htmlfield => undef,
 | ||
|   bool      => undef,
 | ||
| );
 | ||
|  | ||
|  | ||
| # ITEM.part.cvar_by_name(var.config.name)
 | ||
|  | ||
| sub not_matching_sql_and_values {
 | ||
| ... | ... | |
|  | ||
|   my @types;
 | ||
|  | ||
|   # text, textfield, bool are not supported
 | ||
|   my %price_rule_type_by_cvar_type = (
 | ||
|     select    => 'text',
 | ||
|     customer  => 'int',
 | ||
|     vendor    => 'int',
 | ||
|     part      => 'int',
 | ||
|     number    => 'num',
 | ||
|     date      => 'date',
 | ||
|     text      => undef,
 | ||
|     textfield => undef,
 | ||
|     bool      => undef,
 | ||
|     htmlfield => undef,
 | ||
|   );
 | ||
|  | ||
|   my %ops_by_cvar_type = (
 | ||
|     number    => 'num',
 | ||
|     date      => 'date',
 | ||
| t/db/price_rule.t | ||
|---|---|---|
| use Support::TestSetup;
 | ||
| use Test::Exception;
 | ||
|  | ||
| use SL::Controller::CustomVariableConfig;
 | ||
|  | ||
| use SL::Dev::ALL qw(:ALL);
 | ||
| use SL::DB::PriceRule;
 | ||
| use SL::DB::Project;
 | ||
| ... | ... | |
|  | ||
| }
 | ||
|  | ||
|  | ||
| # structural test: check whether the registered CVar types in SL::DB::Manager::PriceRuleItem have all the possible types of SL::Controller::CustomVariableConfigs
 | ||
| for (@SL::Controller::CustomVariableConfig::types) {
 | ||
|   ok(exists $SL::DB::Manager::PriceRuleItem::price_rule_type_by_cvar_type{$_}, "PriceRuleItem has cvar config type $_ registered");
 | ||
| }
 | ||
|  | ||
| # k, now for a more broad test:
 | ||
| #
 | ||
Auch abrufbar als: Unified diff
PriceRules: test um unterstützte CVar Typen mit der vollen liste abzugleichen
Damit sollten wirre Fehler beim hinzufügen von Artikeln nicht mehr
passieren.