Change the name of the sku accessor for shipsSeparately to isShippingSeparately, since it clashes with a property. Add tests. t/Asset/Sku.t passes.

This commit is contained in:
Colin Kuskie 2010-01-20 18:47:35 -08:00
parent caa1f330b8
commit 3a425f29bc
4 changed files with 13 additions and 20 deletions

View file

@ -634,7 +634,7 @@ sub setTaxConfiguration {
#-------------------------------------------------------------------
=head2 shipsSeparately
=head2 isShippingSeparately
Returns a boolean indicating whether this item must be shipped separately from other items.
If the shipsSeparately property is true, but isShippingRequired is false, this will return
@ -642,7 +642,7 @@ false.
=cut
sub shipsSeparately {
sub isShippingSeparately {
my ($self) = @_;
return $self->isShippingRequired && $self->shipsSeparately;
}

View file

@ -60,7 +60,7 @@ sub calculate {
## Two items shipped separately = two bundles
## 1 shipped separately plus 1 not = two bundles
## two items shipped together = one bundle
if ($sku->shipsSeparately) {
if ($sku->isShippingSeparately) {
$separatelyShipped += $quantity;
}
else {

View file

@ -66,7 +66,7 @@ sub buildXML {
my $itemWeight = $sku->getWeight();
##Items that ship separately with a quantity > 1 are rate estimated as 1 item and then the
##shipping cost is multiplied by the quantity.
if (! $sku->shipsSeparately ) {
if (! $sku->isShippingSeparately ) {
$itemWeight *= $item->get('quantity');
}
$weight += $itemWeight;
@ -193,7 +193,7 @@ sub _calculateFromXML {
WebGUI::Error::RemoteShippingRate->throw(error => "Illegal package index returned by USPS: $id");
}
my $unit = $shippableUnits[$id];
if ($unit->[0]->getSku->shipsSeparately) {
if ($unit->[0]->getSku->isShippingSeparately) {
##This is a single item due to ships separately. Since in reality there will be
## N things being shipped, multiply the rate by the quantity.
$cost += $rate * $unit->[0]->get('quantity');
@ -339,7 +339,7 @@ sub _getShippableUnits {
ITEM: foreach my $item (@{$cart->getItems}) {
my $sku = $item->getSku;
next ITEM unless $sku->isShippingRequired;
if ($sku->shipsSeparately) {
if ($sku->isShippingSeparately) {
push @shippableUnits, [ $item ];
}
else {