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