Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
21 |
|
21 |
|
22 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
23 |
|
23 |
|
Lines 192-194
subtest 'aliases' => sub {
Link Here
|
192 |
|
192 |
|
193 |
$schema->storage->txn_rollback(); |
193 |
$schema->storage->txn_rollback(); |
194 |
}; |
194 |
}; |
195 |
- |
195 |
|
|
|
196 |
subtest 'interfaces' => sub { |
197 |
|
198 |
plan tests => 11; |
199 |
|
200 |
$schema->storage->txn_begin(); |
201 |
|
202 |
my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } ); |
203 |
|
204 |
is( $vendor->interfaces->count, 0, 'Vendor has no interfaces' ); |
205 |
|
206 |
$vendor->interfaces( [ { name => 'first interface' }, { name => 'second interface', login => 'one_login' } ] ); |
207 |
|
208 |
$vendor = $vendor->get_from_storage; |
209 |
my $interfaces = $vendor->interfaces; |
210 |
is( $interfaces->count, 2, '2 interfaces stored' ); |
211 |
is( ref($interfaces), 'Koha::Acquisition::Bookseller::Interfaces', 'Type is correct' ); |
212 |
|
213 |
$vendor->interfaces( [ { name => 'first interface', login => 'one_login', password => 'oneP@sswOrd' } ] ); |
214 |
$vendor = $vendor->get_from_storage; |
215 |
$interfaces = $vendor->interfaces; |
216 |
is( $interfaces->count, 1, '1 interface stored' ); |
217 |
my $interface = $interfaces->next; |
218 |
is( $interface->name, 'first interface', 'name correctly saved' ); |
219 |
is( $interface->login, 'one_login', 'login correctly saved' ); |
220 |
is( $interface->uri, undef, 'no value is stored as NULL' ); |
221 |
isnt( $interface->password, 'oneP@sswOrd', 'Password is not stored in plain text' ); |
222 |
isnt( $interface->password, '', 'Password is not removed' ); |
223 |
isnt( $interface->password, undef, 'Password is not set to NULL' ); |
224 |
is( $interface->plain_text_password, 'oneP@sswOrd', 'Password can be retrieved using ->plain_text_password' ); |
225 |
|
226 |
$schema->storage->txn_rollback(); |
227 |
}; |