diff --git a/t/Shop/AddressBook.t b/t/Shop/AddressBook.t index 8181bddf3..7ead6a085 100644 --- a/t/Shop/AddressBook.t +++ b/t/Shop/AddressBook.t @@ -31,7 +31,7 @@ my $session = WebGUI::Test->session; #---------------------------------------------------------------------------- # Tests -my $tests = 20; +my $tests = 22; plan tests => 1 + $tests; #---------------------------------------------------------------------------- @@ -161,18 +161,47 @@ cmp_deeply( '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 # ####################################################################### -$book->delete(); +$bookClone->delete(); $bookCount = $session->db->quickScalar('select count(*) from addressBook'); my $addrCount = $session->db->quickScalar('select count(*) from address'); is($bookCount, 0, 'delete: book deleted'); is($addrCount, 0, 'delete: also deletes addresses in the book'); +undef $book; }