Skip to content

Commit

Permalink
Merge pull request #198 from jmarcher/master
Browse files Browse the repository at this point in the history
Fixed problem with tests (PR from 1.1)
  • Loading branch information
lukepolo authored Jul 4, 2017
2 parents 8ff7fc1 + 7f1729c commit 716b337
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 35 deletions.
81 changes: 47 additions & 34 deletions build/logs/clover.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1493649805">
<project timestamp="1493649805">
<coverage generated="1499169411">
<project timestamp="1499169411">
<package name="LukePOLO\LaraCart">
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Cart.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Cart.php">
<class name="Cart" namespace="LukePOLO\LaraCart">
<metrics methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="6" elements="7" coveredelements="7"/>
</class>
Expand All @@ -15,7 +15,7 @@
<line num="32" type="stmt" count="95"/>
<metrics loc="33" ncloc="25" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="6" coveredstatements="6" elements="7" coveredelements="7"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/CartFee.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/CartFee.php">
<class name="CartFee" namespace="LukePOLO\LaraCart">
<metrics methods="2" coveredmethods="2" conditionals="0" coveredconditionals="0" statements="9" coveredstatements="9" elements="11" coveredelements="11"/>
</class>
Expand All @@ -32,9 +32,9 @@
<line num="51" type="stmt" count="6"/>
<metrics loc="53" ncloc="35" classes="1" methods="2" coveredmethods="2" conditionals="0" coveredconditionals="0" statements="9" coveredstatements="9" elements="11" coveredelements="11"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/CartItem.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/CartItem.php">
<class name="CartItem" namespace="LukePOLO\LaraCart">
<metrics methods="17" coveredmethods="17" conditionals="0" coveredconditionals="0" statements="96" coveredstatements="96" elements="113" coveredelements="113"/>
<metrics methods="17" coveredmethods="17" conditionals="0" coveredconditionals="0" statements="99" coveredstatements="99" elements="116" coveredelements="116"/>
</class>
<line num="54" type="method" name="__construct" crap="2" count="71"/>
<line num="56" type="stmt" count="71"/>
Expand Down Expand Up @@ -90,6 +90,7 @@
<line num="193" type="stmt" count="29"/>
<line num="194" type="stmt" count="3"/>
<line num="198" type="stmt" count="29"/>
<line num="199" type="stmt" count="29"/>
<line num="200" type="stmt" count="29"/>
<line num="201" type="stmt" count="29"/>
<line num="215" type="method" name="subTotal" crap="3" count="28"/>
Expand All @@ -99,7 +100,7 @@
<line num="223" type="stmt" count="28"/>
<line num="224" type="stmt" count="3"/>
<line num="227" type="stmt" count="28"/>
<line num="239" type="method" name="subItemsTotal" crap="3" count="30"/>
<line num="239" type="method" name="subItemsTotal" crap="4" count="30"/>
<line num="241" type="stmt" count="30"/>
<line num="243" type="stmt" count="30"/>
<line num="244" type="stmt" count="7"/>
Expand All @@ -111,8 +112,10 @@
<line num="265" type="stmt" count="28"/>
<line num="266" type="stmt" count="8"/>
<line num="269" type="stmt" count="28"/>
<line num="270" type="stmt" count="28"/>
<line num="271" type="stmt" count="28"/>
<line num="272" type="stmt" count="28"/>
<line num="273" type="stmt" count="28"/>
<line num="284" type="method" name="tax" crap="4" count="23"/>
<line num="286" type="stmt" count="23"/>
<line num="287" type="stmt" count="5"/>
Expand Down Expand Up @@ -149,9 +152,9 @@
<line num="366" type="stmt" count="1"/>
<line num="367" type="stmt" count="1"/>
<line num="368" type="stmt" count="1"/>
<metrics loc="369" ncloc="248" classes="1" methods="17" coveredmethods="17" conditionals="0" coveredconditionals="0" statements="96" coveredstatements="96" elements="113" coveredelements="113"/>
<metrics loc="369" ncloc="248" classes="1" methods="17" coveredmethods="17" conditionals="0" coveredconditionals="0" statements="99" coveredstatements="99" elements="116" coveredelements="116"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/CartSubItem.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/CartSubItem.php">
<class name="CartSubItem" namespace="LukePOLO\LaraCart">
<metrics methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="17" coveredstatements="17" elements="21" coveredelements="21"/>
</class>
Expand All @@ -178,9 +181,9 @@
<line num="85" type="stmt" count="1"/>
<metrics loc="86" ncloc="58" classes="1" methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="17" coveredstatements="17" elements="21" coveredelements="21"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/LaraCart.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/LaraCart.php">
<class name="LaraCart" namespace="LukePOLO\LaraCart">
<metrics methods="43" coveredmethods="41" conditionals="0" coveredconditionals="0" statements="215" coveredstatements="213" elements="258" coveredelements="254"/>
<metrics methods="43" coveredmethods="41" conditionals="0" coveredconditionals="0" statements="222" coveredstatements="214" elements="265" coveredelements="255"/>
</class>
<line num="38" type="method" name="__construct" crap="1" count="95"/>
<line num="40" type="stmt" count="95"/>
Expand Down Expand Up @@ -231,7 +234,7 @@
<line num="169" type="stmt" count="1"/>
<line num="183" type="method" name="addLine" crap="1" count="3"/>
<line num="185" type="stmt" count="3"/>
<line num="203" type="method" name="add" crap="6.01" count="71"/>
<line num="203" type="method" name="add" crap="6.79" count="71"/>
<line num="212" type="stmt" count="71"/>
<line num="213" type="stmt" count="5"/>
<line num="215" type="stmt" count="5"/>
Expand All @@ -248,6 +251,13 @@
<line num="235" type="stmt" count="5"/>
<line num="237" type="stmt" count="5"/>
<line num="240" type="stmt" count="71"/>
<line num="241" type="stmt" count="0"/>
<line num="242" type="stmt" count="0"/>
<line num="243" type="stmt" count="0"/>
<line num="244" type="stmt" count="0"/>
<line num="245" type="stmt" count="0"/>
<line num="246" type="stmt" count="0"/>
<line num="247" type="stmt" count="71"/>
<line num="250" type="stmt" count="71"/>
<line num="252" type="stmt" count="71"/>
<line num="262" type="method" name="addItem" crap="2" count="71"/>
Expand Down Expand Up @@ -440,17 +450,17 @@
<line num="819" type="stmt" count="2"/>
<line num="820" type="stmt" count="2"/>
<line num="823" type="stmt" count="3"/>
<metrics loc="824" ncloc="538" classes="1" methods="43" coveredmethods="41" conditionals="0" coveredconditionals="0" statements="215" coveredstatements="213" elements="258" coveredelements="254"/>
<metrics loc="824" ncloc="538" classes="1" methods="43" coveredmethods="41" conditionals="0" coveredconditionals="0" statements="222" coveredstatements="214" elements="265" coveredelements="255"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/LaraCartHasher.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/LaraCartHasher.php">
<class name="LaraCartHasher" namespace="LukePOLO\LaraCart">
<metrics methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
</class>
<line num="7" type="method" name="hash" crap="1" count="69"/>
<line num="9" type="stmt" count="69"/>
<metrics loc="11" ncloc="11" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="1" coveredstatements="1" elements="2" coveredelements="2"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/LaraCartServiceProvider.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/LaraCartServiceProvider.php">
<class name="LaraCartServiceProvider" namespace="LukePOLO\LaraCart">
<metrics methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="20" coveredstatements="20" elements="24" coveredelements="24"/>
</class>
Expand Down Expand Up @@ -482,16 +492,16 @@
<metrics loc="69" ncloc="51" classes="1" methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="21" coveredstatements="21" elements="25" coveredelements="25"/>
</file>
</package>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Contracts/CouponContract.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Contracts/CouponContract.php">
<metrics loc="31" ncloc="12" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Contracts/LaraCartContract.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Contracts/LaraCartContract.php">
<metrics loc="294" ncloc="81" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<package name="LukePOLO\LaraCart\Coupons">
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Coupons/Fixed.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Coupons/Fixed.php">
<class name="Fixed" namespace="LukePOLO\LaraCart\Coupons">
<metrics methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="13" coveredstatements="13" elements="16" coveredelements="16"/>
<metrics methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="16" coveredstatements="16" elements="19" coveredelements="19"/>
</class>
<line num="26" type="method" name="__construct" crap="1" count="13"/>
<line num="28" type="stmt" count="13"/>
Expand All @@ -509,9 +519,12 @@
<line num="66" type="method" name="displayValue" crap="1" count="1"/>
<line num="68" type="stmt" count="1"/>
<line num="69" type="stmt" count="1"/>
<metrics loc="75" ncloc="49" classes="1" methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="13" coveredstatements="13" elements="16" coveredelements="16"/>
<line num="70" type="stmt" count="1"/>
<line num="71" type="stmt" count="1"/>
<line num="72" type="stmt" count="1"/>
<metrics loc="75" ncloc="49" classes="1" methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="16" coveredstatements="16" elements="19" coveredelements="19"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Coupons/Percentage.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Coupons/Percentage.php">
<class name="Percentage" namespace="LukePOLO\LaraCart\Coupons">
<metrics methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="10" coveredstatements="10" elements="13" coveredelements="13"/>
</class>
Expand All @@ -532,39 +545,39 @@
</file>
</package>
<package name="LukePOLO\LaraCart\Exceptions">
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Exceptions/CouponException.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Exceptions/CouponException.php">
<class name="CouponException" namespace="LukePOLO\LaraCart\Exceptions">
<metrics methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="7" classes="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Exceptions/InvalidPrice.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Exceptions/InvalidPrice.php">
<class name="InvalidPrice" namespace="LukePOLO\LaraCart\Exceptions">
<metrics methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="7" classes="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Exceptions/InvalidQuantity.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Exceptions/InvalidQuantity.php">
<class name="InvalidQuantity" namespace="LukePOLO\LaraCart\Exceptions">
<metrics methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="7" classes="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Exceptions/InvalidTaxableValue.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Exceptions/InvalidTaxableValue.php">
<class name="InvalidTaxableValue" namespace="LukePOLO\LaraCart\Exceptions">
<metrics methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="7" classes="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Exceptions/ModelNotFound.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Exceptions/ModelNotFound.php">
<class name="ModelNotFound" namespace="LukePOLO\LaraCart\Exceptions">
<metrics methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</class>
<metrics loc="10" ncloc="7" classes="1" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
</package>
<package name="LukePOLO\LaraCart\Facades">
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Facades/LaraCart.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Facades/LaraCart.php">
<class name="LaraCart" namespace="LukePOLO\LaraCart\Facades">
<metrics methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="3" coveredstatements="0" elements="4" coveredelements="0"/>
</class>
Expand All @@ -576,15 +589,15 @@
</file>
</package>
<package name="LukePOLO\LaraCart\Traits">
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Traits/CartOptionsMagicMethodsTrait.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Traits/CartOptionsMagicMethodsTrait.php">
<class name="CartOptionsMagicMethodsTrait" namespace="LukePOLO\LaraCart\Traits">
<metrics methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="26" coveredstatements="26" elements="29" coveredelements="29"/>
</class>
<line num="24" type="method" name="__get" crap="2" count="60"/>
<line num="27" type="stmt" count="60"/>
<line num="28" type="stmt" count="60"/>
<line num="29" type="stmt" count="60"/>
<line num="43" type="method" name="__set" crap="15" count="72"/>
<line num="43" type="method" name="__set" crap="14" count="72"/>
<line num="46" type="stmt" count="72"/>
<line num="47" type="stmt" count="71"/>
<line num="48" type="stmt" count="1"/>
Expand All @@ -611,7 +624,7 @@
<line num="86" type="stmt" count="4"/>
<metrics loc="89" ncloc="62" classes="1" methods="3" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="26" coveredstatements="26" elements="29" coveredelements="29"/>
</file>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/Traits/CouponTrait.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/Traits/CouponTrait.php">
<class name="CouponTrait" namespace="LukePOLO\LaraCart\Traits">
<metrics methods="7" coveredmethods="7" conditionals="0" coveredconditionals="0" statements="34" coveredstatements="34" elements="41" coveredelements="41"/>
</class>
Expand Down Expand Up @@ -659,17 +672,17 @@
<metrics loc="174" ncloc="106" classes="1" methods="7" coveredmethods="7" conditionals="0" coveredconditionals="0" statements="34" coveredstatements="34" elements="41" coveredelements="41"/>
</file>
</package>
<file name="/Users/LukePOLO/PhpstormProjects/laracart/src/config/laracart.php">
<file name="/home/gordo/Documents/Codigos/laracart/src/config/laracart.php">
<line num="11" type="stmt" count="95"/>
<line num="33" type="stmt" count="1"/>
<line num="97" type="stmt" count="1"/>
<line num="114" type="stmt" count="1"/>
<line num="115" type="stmt" count="1"/>
<line num="116" type="stmt" count="1"/>
<line num="117" type="stmt" count="1"/>
<line num="118" type="stmt" count="0"/>
<metrics loc="149" ncloc="35" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="7" elements="8" coveredelements="7"/>
<line num="118" type="stmt" count="1"/>
<metrics loc="149" ncloc="35" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="8" elements="8" coveredelements="8"/>
</file>
<metrics files="20" loc="2391" ncloc="1398" classes="17" methods="89" coveredmethods="86" conditionals="0" coveredconditionals="0" statements="459" coveredstatements="453" elements="548" coveredelements="539"/>
<metrics files="20" loc="2391" ncloc="1398" classes="17" methods="89" coveredmethods="86" conditionals="0" coveredconditionals="0" statements="472" coveredstatements="461" elements="561" coveredelements="547"/>
</project>
</coverage>
2 changes: 1 addition & 1 deletion src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function subItemsTotal($format = true, $taxedItemsOnly = false, $withTax
$total = 0;

foreach ($this->subItems as $subItem) {
$total += $subItem->price(false, $taxedItemsOnly);
$total += $subItem->price(false, $taxedItemsOnly) * ($subItem->qty ?: 1);
}

if ($withTax) {
Expand Down

0 comments on commit 716b337

Please sign in to comment.