|
Lines 33-39
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 33 |
|
33 |
|
| 34 |
subtest 'store() repeatable attributes tests' => sub { |
34 |
subtest 'store() repeatable attributes tests' => sub { |
| 35 |
|
35 |
|
| 36 |
plan tests => 4; |
36 |
plan tests => 5; |
| 37 |
|
37 |
|
| 38 |
$schema->storage->txn_begin; |
38 |
$schema->storage->txn_begin; |
| 39 |
|
39 |
|
|
Lines 84-89
subtest 'store() repeatable attributes tests' => sub {
Link Here
|
| 84 |
} |
84 |
} |
| 85 |
'Koha::Exceptions::Patron::Attribute::NonRepeatable', |
85 |
'Koha::Exceptions::Patron::Attribute::NonRepeatable', |
| 86 |
'Exception thrown trying to store more than one non-repeatable attribute'; |
86 |
'Exception thrown trying to store more than one non-repeatable attribute'; |
|
|
87 |
|
| 88 |
is( |
| 89 |
"$@", |
| 90 |
"Tried to add more than one non-repeatable attributes. code=" |
| 91 |
. $attribute_type_2->{code} |
| 92 |
. " attribute=Bar", |
| 93 |
'Exception stringified correctly, attribute passed correctly' |
| 94 |
); |
| 95 |
|
| 87 |
my $attributes = Koha::Patron::Attributes->search( |
96 |
my $attributes = Koha::Patron::Attributes->search( |
| 88 |
{ borrowernumber => $patron, code => $attribute_type_2->{code} } ); |
97 |
{ borrowernumber => $patron, code => $attribute_type_2->{code} } ); |
| 89 |
is( $attributes->count, 1, '1 non-repeatable attribute stored' ); |
98 |
is( $attributes->count, 1, '1 non-repeatable attribute stored' ); |
|
Lines 95-101
subtest 'store() repeatable attributes tests' => sub {
Link Here
|
| 95 |
|
104 |
|
| 96 |
subtest 'store() unique_id attributes tests' => sub { |
105 |
subtest 'store() unique_id attributes tests' => sub { |
| 97 |
|
106 |
|
| 98 |
plan tests => 4; |
107 |
plan tests => 5; |
| 99 |
|
108 |
|
| 100 |
$schema->storage->txn_begin; |
109 |
$schema->storage->txn_begin; |
| 101 |
|
110 |
|
|
Lines 148-153
subtest 'store() unique_id attributes tests' => sub {
Link Here
|
| 148 |
} |
157 |
} |
| 149 |
'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint', |
158 |
'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint', |
| 150 |
'Exception thrown trying to store more than one unique attribute'; |
159 |
'Exception thrown trying to store more than one unique attribute'; |
|
|
160 |
|
| 161 |
is( |
| 162 |
"$@", |
| 163 |
"Your action breaks a unique constraint on the attribute. code=" |
| 164 |
. $attribute_type_2->{code} |
| 165 |
. " attribute=Foo", |
| 166 |
'Exception stringified correctly, attribute passed correctly' |
| 167 |
); |
| 168 |
|
| 151 |
my $attributes = Koha::Patron::Attributes->search( |
169 |
my $attributes = Koha::Patron::Attributes->search( |
| 152 |
{ borrowernumber => $patron_1, code => $attribute_type_2->{code} } ); |
170 |
{ borrowernumber => $patron_1, code => $attribute_type_2->{code} } ); |
| 153 |
is( $attributes->count, 1, '1 unique attribute stored' ); |
171 |
is( $attributes->count, 1, '1 unique attribute stored' ); |
| 154 |
- |
|
|