projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SL::File: get_all_versions mit dbfile als Parameter gefixed
[kivitendo-erp.git]
/
t
/
db_helper
/
with_transaction.t
diff --git
a/t/db_helper/with_transaction.t
b/t/db_helper/with_transaction.t
index
6d49a20
..
cc3fc0e
100644
(file)
--- a/
t/db_helper/with_transaction.t
+++ b/
t/db_helper/with_transaction.t
@@
-10,7
+10,7
@@
use Carp;
use Data::Dumper;
use Support::TestSetup;
use SL::DB::Part;
use Data::Dumper;
use Support::TestSetup;
use SL::DB::Part;
-use SL::Dev::Part;
+use SL::Dev::Part
qw(new_part)
;
Support::TestSetup::login();
Support::TestSetup::login();
@@
-21,7
+21,7
@@
local $SIG{__WARN__} = sub {};
# test simple transaction
# test simple transaction
-my $part =
create
_part();
+my $part =
new
_part();
SL::DB->client->with_transaction(sub {
$part->save;
ok 1, 'part saved';
SL::DB->client->with_transaction(sub {
$part->save;
ok 1, 'part saved';
@@
-31,7
+31,7
@@
SL::DB->client->with_transaction(sub {
};
# test failing transaction
};
# test failing transaction
-my $part2 =
create
_part(partnumber => $part->partnumber); # woops, duplicate partnumber
+my $part2 =
new
_part(partnumber => $part->partnumber); # woops, duplicate partnumber
SL::DB->client->with_transaction(sub {
$part2->save;
ok 0, 'part saved';
SL::DB->client->with_transaction(sub {
$part2->save;
ok 0, 'part saved';
@@
-55,13
+55,13
@@
dies_ok {
# TODO - not possible to test without locally adding hooks in run time
# test if error gets correctly stored in db->error
# TODO - not possible to test without locally adding hooks in run time
# test if error gets correctly stored in db->error
-$part2 =
create
_part(partnumber => $part->partnumber); # woops, duplicate partnumber
+$part2 =
new
_part(partnumber => $part->partnumber); # woops, duplicate partnumber
SL::DB->client->with_transaction(sub {
$part2->save;
ok 0, 'part saved';
1;
}) or do {
SL::DB->client->with_transaction(sub {
$part2->save;
ok 0, 'part saved';
1;
}) or do {
- like(SL::DB->client->error, qr/
duplicate key value violates unique constraint/
, 'error is in db->error');
+ like(SL::DB->client->error, qr/
unique.constraint/i
, 'error is in db->error');
};
# test stacked transactions
};
# test stacked transactions
@@
-127,7
+127,7
@@
SL::DB->client->with_transaction(sub {
1;
}) or do {
ok 1, 'sql error in nested transaction rolls back';
1;
}) or do {
ok 1, 'sql error in nested transaction rolls back';
- like(SL::DB->client->error, qr/
duplicate key value violates unique constraint/
, 'error from nested transaction is in db->error');
+ like(SL::DB->client->error, qr/
unique.constraint/i
, 'error from nested transaction is in db->error');
};
$part->load;
};
$part->load;
@@
-242,4
+242,3
@@
eval {
$part->load;
is $part->sellprice, "3.00000", 'saved part is not affected';
$part->load;
is $part->sellprice, "3.00000", 'saved part is not affected';
-