Lines 28-34
use t::lib::TestBuilder;
Link Here
|
28 |
my $schema = Koha::Database->new->schema; |
28 |
my $schema = Koha::Database->new->schema; |
29 |
|
29 |
|
30 |
subtest 'store + regexs' => sub { |
30 |
subtest 'store + regexs' => sub { |
31 |
plan tests => 1; |
31 |
plan tests => 2; |
32 |
$schema->storage->txn_begin; |
32 |
$schema->storage->txn_begin; |
33 |
|
33 |
|
34 |
my @regexs = ('s/\s/\n/g', 's/(\s?=)/\n=/g', 's/^(J|K)\n/$1 /'); |
34 |
my @regexs = ('s/\s/\n/g', 's/(\s?=)/\n=/g', 's/^(J|K)\n/$1 /'); |
Lines 37-47
subtest 'store + regexs' => sub {
Link Here
|
37 |
class_split_rule => 'split_rule', |
37 |
class_split_rule => 'split_rule', |
38 |
description => 'a_split_test_1', |
38 |
description => 'a_split_test_1', |
39 |
split_routine => 'regex', |
39 |
split_routine => 'regex', |
40 |
regexs => \@regexs, |
|
|
41 |
} |
40 |
} |
42 |
)->store; |
41 |
)->store; |
43 |
|
42 |
|
44 |
$rule = Koha::ClassSplitRules->find("split_rule"); |
43 |
$rule = Koha::ClassSplitRules->find("split_rule"); |
|
|
44 |
is_deeply($rule->regexs, [], '->regexs return an empty array when no regex is defined'); |
45 |
|
46 |
$rule->regexs(\@regexs)->store; |
47 |
|
48 |
$rule = Koha::ClassSplitRules->find("split_rule"); |
45 |
is_deeply($rule->regexs, \@regexs, '->new and ->regexs correctly serialized/deserialized the regexs'); |
49 |
is_deeply($rule->regexs, \@regexs, '->new and ->regexs correctly serialized/deserialized the regexs'); |
46 |
|
50 |
|
47 |
$schema->storage->txn_rollback; |
51 |
$schema->storage->txn_rollback; |
48 |
- |
|
|