7
7
8
8
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
9
9
10
+ /**
11
+ * Class GrandTest
12
+ *
13
+ * @package Magento\Quote\Test\Unit\Model\Quote\Address\Total
14
+ */
10
15
class GrandTest extends \PHPUnit_Framework_TestCase
11
16
{
12
17
/**
@@ -17,9 +22,14 @@ class GrandTest extends \PHPUnit_Framework_TestCase
17
22
protected function setUp ()
18
23
{
19
24
$ objectManager = new ObjectManager ($ this );
20
- $ this ->model = $ objectManager ->getObject ('Magento\Quote\Model\Quote\Address\Total\Grand ' );
25
+ $ this ->model = $ objectManager ->getObject (
26
+ \Magento \Quote \Model \Quote \Address \Total \Grand::class
27
+ );
21
28
}
22
29
30
+ /**
31
+ * Test case for quote totals collect
32
+ */
23
33
public function testCollect ()
24
34
{
25
35
$ totals = [1 , 2 , 3.4 ];
@@ -28,20 +38,29 @@ public function testCollect()
28
38
$ grandTotalBase = 15.7 ; // 4 + 5 + 6.7
29
39
30
40
$ totalMock = $ this ->getMock (
31
- '\Magento\Quote\Model\Quote\Address\Total ' ,
32
- ['getAllTotalAmounts ' , 'getAllBaseTotalAmounts ' , 'setGrandTotal ' , 'setBaseGrandTotal ' ],
41
+ \Magento \Quote \Model \Quote \Address \Total::class,
42
+ [
43
+ 'getAllTotalAmounts ' ,
44
+ 'getAllBaseTotalAmounts ' ,
45
+ 'setGrandTotal ' ,
46
+ 'setBaseGrandTotal ' ,
47
+ 'getGrandTotal ' ,
48
+ 'getBaseGrandTotal '
49
+ ],
33
50
[],
34
51
'' ,
35
52
false
36
53
);
54
+ $ totalMock ->expects ($ this ->once ())->method ('getGrandTotal ' )->willReturn (2 );
55
+ $ totalMock ->expects ($ this ->once ())->method ('getBaseGrandTotal ' )->willReturn (2 );
37
56
$ totalMock ->expects ($ this ->once ())->method ('getAllTotalAmounts ' )->willReturn ($ totals );
38
57
$ totalMock ->expects ($ this ->once ())->method ('getAllBaseTotalAmounts ' )->willReturn ($ totalsBase );
39
- $ totalMock ->expects ($ this ->once ())->method ('setGrandTotal ' )->with ($ grandTotal );
40
- $ totalMock ->expects ($ this ->once ())->method ('setBaseGrandTotal ' )->with ($ grandTotalBase );
58
+ $ totalMock ->expects ($ this ->once ())->method ('setGrandTotal ' )->with ($ grandTotal + 2 );
59
+ $ totalMock ->expects ($ this ->once ())->method ('setBaseGrandTotal ' )->with ($ grandTotalBase + 2 );
41
60
42
61
$ this ->model ->collect (
43
- $ this ->getMock (' \Magento\Quote\Model\Quote ' , [], [], '' , false ),
44
- $ this ->getMock (' \Magento\Quote\Api\Data\ShippingAssignmentInterface ' ),
62
+ $ this ->getMock (\Magento \Quote \Model \Quote::class , [], [], '' , false ),
63
+ $ this ->getMock (\Magento \Quote \Api \Data \ShippingAssignmentInterface::class ),
45
64
$ totalMock
46
65
);
47
66
}
0 commit comments