]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/perlmods/live_t/08-lp1366964-libdbi-error.t
LP1615805 No inputs after submit in patron search (AngularJS)
[Evergreen.git] / Open-ILS / src / perlmods / live_t / 08-lp1366964-libdbi-error.t
1 #!perl
2
3 use Test::More tests => 2;
4
5 diag("Tests libdbi transaction error reporting");
6
7 use strict; use warnings;
8
9 use OpenILS::Utils::TestUtils;
10 use OpenILS::Utils::CStoreEditor (':funcs');
11 use OpenILS::Utils::Fieldmapper;
12 my $script = OpenILS::Utils::TestUtils->new();
13 $script->bootstrap;
14
15 my $e = new_editor(xact => 1);
16 $e->init;
17
18 # create a copy status object with ID 1, which will fail.
19 my $stat = Fieldmapper::config::copy_status->new;
20 $stat->id(1);
21
22 # when functioning well, this should happen and fail quickly
23 my $start = time;
24 $e->create_config_copy_status($stat);
25 my $evt = $e->die_event; # this part takes the longest
26 my $duration = time - $start;
27
28 cmp_ok($duration, '<', '10', 
29     'Confirm cstore reports standard update query error in a timely fashion');
30
31 if ($evt) {
32     is($evt->{textcode}, 'DATABASE_UPDATE_FAILED',
33         'CStoreEditor returns standard update query error');
34 } else {
35     fail('CStoreEditor returned no event');
36 }
37
38
39