Merge commit '41575d24bb' into webgui8. Some tests still failing.
Conflicts: docs/gotcha.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/File/GalleryFile/Photo.pm lib/WebGUI/Asset/Post.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/WikiPage.pm lib/WebGUI/Asset/Wobject/WikiMaster.pm lib/WebGUI/Cache.pm lib/WebGUI/Content/Setup.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Pay.pm lib/WebGUI/Shop/PayDriver/ITransact.pm sbin/testEnvironment.pl t/Asset/WikiPage.t t/Shop/PayDriver.t t/Shop/PayDriver/ITransact.t t/Shop/PayDriver/Ogone.t t/Shop/TaxDriver/EU.t t/Shop/TaxDriver/Generic.t t/Workflow/Activity/RemoveOldCarts.t t/lib/WebGUI/Test.pm
This commit is contained in:
commit
5febc0ebbc
258 changed files with 5528 additions and 2230 deletions
|
|
@ -27,6 +27,7 @@ use WebGUI::Session;
|
|||
use WebGUI::Text;
|
||||
use WebGUI::Shop::Cart;
|
||||
use WebGUI::Shop::AddressBook;
|
||||
use WebGUI::Shop::TaxDriver::EU;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -36,6 +37,7 @@ my $session = WebGUI::Test->session;
|
|||
my $taxUser = WebGUI::User->new( $session, 'new' );
|
||||
$taxUser->username( 'Tex Evasion' );
|
||||
WebGUI::Test->addToCleanup($taxUser);
|
||||
$session->user({userId => $taxUser->getId});
|
||||
|
||||
# Test VAT numbers
|
||||
my $testVAT_NL = 'NL123456789B12';
|
||||
|
|
@ -58,8 +60,10 @@ my $sku = WebGUI::Asset->getRoot($session)->addChild( {
|
|||
title => 'Taxable donation',
|
||||
defaultPrice => 100.00,
|
||||
} );
|
||||
WebGUI::Test->addToCleanup($sku);
|
||||
|
||||
my $book = WebGUI::Shop::AddressBook->create($session);
|
||||
WebGUI::Test->addToCleanup($book);
|
||||
|
||||
# setup address in EU but not in residential country of merchant
|
||||
my $beAddress = $book->addAddress({
|
||||
|
|
@ -82,22 +86,15 @@ my $usAddress = $book->addAddress({
|
|||
country => 'US',
|
||||
});
|
||||
|
||||
my $cart;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 342;
|
||||
plan tests => 1 + $tests;
|
||||
plan tests => $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
my $loaded = use_ok('WebGUI::Shop::TaxDriver::EU');
|
||||
|
||||
SKIP: {
|
||||
|
||||
skip 'Unable to load module WebGUI::Shop::TaxDriver::EU', $tests unless $loaded;
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
|
|
@ -474,7 +471,8 @@ SKIP: {
|
|||
), 'appendCartItemVars returns correct error for missing CartItem' );
|
||||
|
||||
|
||||
$cart = WebGUI::Shop::Cart->newBySession( $session );
|
||||
my $cart = WebGUI::Shop::Cart->newBySession( $session );
|
||||
WebGUI::Test->addToCleanup($cart);
|
||||
|
||||
my $item = $cart->addItem( $sku );
|
||||
$item->setQuantity( 2 );
|
||||
|
|
@ -554,8 +552,6 @@ SKIP: {
|
|||
}
|
||||
|
||||
|
||||
} #SKIP BLOCK
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub setupTestNumbers {
|
||||
my $taxer = WebGUI::Shop::TaxDriver::EU->new($session);
|
||||
|
|
@ -574,11 +570,8 @@ sub setupTestNumbers {
|
|||
# Cleanup
|
||||
END {
|
||||
$session->db->write('delete from tax_eu_vatNumbers');
|
||||
$cart->delete;
|
||||
$session->db->write('delete from cart');
|
||||
$session->db->write('delete from addressBook');
|
||||
$session->db->write('delete from address');
|
||||
$session->db->write('delete from taxDriver where className=?', [ 'WebGUI::Shop::TaxDriver::EU' ]);
|
||||
|
||||
$sku->purge;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,14 @@ use WebGUI::Shop::TaxDriver::Generic;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user({userId => 3});
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $addExceptions = getAddExceptions($session);
|
||||
|
||||
plan tests => 78
|
||||
plan tests => 79
|
||||
+ 2*scalar(@{$addExceptions});
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -471,6 +472,7 @@ $taxer->importTaxData(
|
|||
WebGUI::Test->getTestCollateralPath('taxTables/largeTaxTable.csv')
|
||||
),
|
||||
my $book = WebGUI::Shop::AddressBook->create($session);
|
||||
WebGUI::Test->addToCleanup($book);
|
||||
my $taxingAddress = $book->addAddress({
|
||||
label => 'taxing',
|
||||
city => 'Madison',
|
||||
|
|
@ -579,12 +581,11 @@ $tag2->commit;
|
|||
WebGUI::Test->addToCleanup($tag2);
|
||||
$taxFreeDonation = $taxFreeDonation->cloneFromDb;
|
||||
|
||||
$taxFreeDonation->setTaxConfiguration( 'WebGUI::Shop::TaxDriver::Generic', {
|
||||
overrideTaxRate => 1,
|
||||
taxRateOverride => 0,
|
||||
});
|
||||
my $tax = $taxer->getTaxRate( $taxableDonation, $taxingAddress );
|
||||
is($tax, 5.5, 'calculate: simple tax calculation on 1 item in the cart');
|
||||
|
||||
is($taxer->getTaxRate( $taxFreeDonation, $taxingAddress), 0, 'getTaxRate: tax rate override should override tax derived from address');
|
||||
$cart->update({ shippingAddressId => $taxFreeAddress->getId});
|
||||
is($taxer->getTaxRate( $taxableDonation, $taxFreeAddress ), 0, 'calculate: simple tax calculation on 1 item in the cart, tax free location');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue