coverage tests for AddressBook update
This commit is contained in:
parent
d27ac7a629
commit
17faa35f27
1 changed files with 31 additions and 2 deletions
|
|
@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
my $tests = 20;
|
my $tests = 22;
|
||||||
plan tests => 1 + $tests;
|
plan tests => 1 + $tests;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -161,18 +161,47 @@ cmp_deeply(
|
||||||
'getAddresses returns all address objects for this book'
|
'getAddresses returns all address objects for this book'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# update
|
||||||
|
#
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
$book->update({ lastShipId => $address1->getId, lastPayId => $address2->getId});
|
||||||
|
|
||||||
|
cmp_deeply(
|
||||||
|
$book->get(),
|
||||||
|
{
|
||||||
|
userId => ignore,
|
||||||
|
sessionId => ignore,
|
||||||
|
addressBookId => ignore,
|
||||||
|
lastShipId => $address1->getId,
|
||||||
|
lastPayId => $address2->getId,
|
||||||
|
},
|
||||||
|
'update updates the object properties cache'
|
||||||
|
);
|
||||||
|
|
||||||
|
my $bookClone = WebGUI::Shop::AddressBook->new($session, $book->getId);
|
||||||
|
|
||||||
|
cmp_deeply(
|
||||||
|
$bookClone,
|
||||||
|
$book,
|
||||||
|
'update updates the db, too'
|
||||||
|
);
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# delete
|
# delete
|
||||||
#
|
#
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
$book->delete();
|
$bookClone->delete();
|
||||||
$bookCount = $session->db->quickScalar('select count(*) from addressBook');
|
$bookCount = $session->db->quickScalar('select count(*) from addressBook');
|
||||||
my $addrCount = $session->db->quickScalar('select count(*) from address');
|
my $addrCount = $session->db->quickScalar('select count(*) from address');
|
||||||
|
|
||||||
is($bookCount, 0, 'delete: book deleted');
|
is($bookCount, 0, 'delete: book deleted');
|
||||||
is($addrCount, 0, 'delete: also deletes addresses in the book');
|
is($addrCount, 0, 'delete: also deletes addresses in the book');
|
||||||
|
undef $book;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue