|
Lines 241-247
subtest "Test update method" => sub {
Link Here
|
| 241 |
|
241 |
|
| 242 |
subtest 'store() tests' => sub { |
242 |
subtest 'store() tests' => sub { |
| 243 |
|
243 |
|
| 244 |
plan tests => 7; |
244 |
plan tests => 8; |
| 245 |
|
245 |
|
| 246 |
# Using Koha::ApiKey to test Koha::Object>-store |
246 |
# Using Koha::ApiKey to test Koha::Object>-store |
| 247 |
# Simple object with foreign keys and unique key |
247 |
# Simple object with foreign keys and unique key |
|
Lines 305-310
subtest 'store() tests' => sub {
Link Here
|
| 305 |
my $ret = $api_key->store; |
305 |
my $ret = $api_key->store; |
| 306 |
is( ref($ret), 'Koha::ApiKey', 'store() returns the object on success' ); |
306 |
is( ref($ret), 'Koha::ApiKey', 'store() returns the object on success' ); |
| 307 |
|
307 |
|
|
|
308 |
subtest 'Bad value tests' => sub { |
| 309 |
|
| 310 |
plan tests => 1; |
| 311 |
|
| 312 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 313 |
|
| 314 |
my $print_error = $schema->storage->dbh->{PrintError}; |
| 315 |
$schema->storage->dbh->{PrintError} = 0; |
| 316 |
|
| 317 |
throws_ok |
| 318 |
{ $patron->lastseen('wrong_value')->store; } |
| 319 |
'Koha::Exceptions::Object::BadValue', |
| 320 |
'Exception thrown correctly'; |
| 321 |
|
| 322 |
$schema->storage->dbh->{PrintError} = $print_error; |
| 323 |
}; |
| 324 |
|
| 308 |
$schema->storage->txn_rollback; |
325 |
$schema->storage->txn_rollback; |
| 309 |
}; |
326 |
}; |
| 310 |
|
327 |
|
| 311 |
- |
|
|