@@ -30,7 +30,7 @@ class ConfiguredPriceTest extends TestCase
30
30
/**
31
31
* @var float
32
32
*/
33
- private $ basePriceValue = 100. ;
33
+ private $ basePriceValue = 100.00 ;
34
34
35
35
/**
36
36
* @var ItemInterface|MockObject
@@ -43,9 +43,9 @@ class ConfiguredPriceTest extends TestCase
43
43
private $ productMock ;
44
44
45
45
/**
46
- * @var MockObject
46
+ * @var Calculator| MockObject
47
47
*/
48
- private $ calculator ;
48
+ private $ calculatorMock ;
49
49
50
50
/**
51
51
* @var Base|MockObject
@@ -97,12 +97,6 @@ protected function setUp(): void
97
97
->disableOriginalConstructor ()
98
98
->getMock ();
99
99
$ this ->productMock ->expects ($ this ->once ())->method ('getPriceInfo ' )->willReturn ($ this ->priceInfoMock );
100
- $ this ->productMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (123 );
101
-
102
- $ this ->itemMock = $ this ->getMockBuilder (ItemInterface::class)
103
- ->getMock ();
104
- $ this ->itemMock ->expects ($ this ->any ())->method ('getProduct ' )->willReturn ($ this ->productMock );
105
-
106
100
$ this ->priceCurrencyMock = $ this ->getMockForAbstractClass (PriceCurrencyInterface::class);
107
101
108
102
$ this ->jsonSerializerMock = $ this ->getMockBuilder (Json::class)
@@ -115,37 +109,41 @@ protected function setUp(): void
115
109
->willReturn ($ this ->prepareAndReturnSelectionPriceDataStub ());
116
110
$ this ->amountInterfaceMock = $ this ->getMockBuilder (AmountInterface::class)->getMock ();
117
111
$ this ->amountInterfaceMock ->expects ($ this ->any ())->method ('getBaseAmount ' )
118
- ->willReturn (100.0 );
119
- $ this ->calculator = $ this ->getMockBuilder (Calculator::class)
112
+ ->willReturn (100.00 );
113
+ $ this ->calculatorMock = $ this ->getMockBuilder (Calculator::class)
120
114
->disableOriginalConstructor ()
121
115
->getMock ();
122
- $ this ->calculator ->expects ($ this ->any ())->method ('calculateBundleAmount ' )
116
+ $ this ->calculatorMock ->expects ($ this ->any ())->method ('calculateBundleAmount ' )
123
117
->willReturn ($ this ->amountInterfaceMock );
124
118
$ this ->discountCalculatorMock = $ this ->getMockBuilder (DiscountCalculator::class)
125
119
->disableOriginalConstructor ()
126
120
->getMock ();
127
121
$ this ->discountCalculatorMock ->expects ($ this ->any ())->method ('calculateDiscount ' )
128
- ->willReturn (-5.0 );
122
+ ->willReturn (-5.00 );
129
123
$ this ->model = new ConfiguredPrice (
130
124
$ this ->productMock ,
131
125
1 ,
132
- $ this ->calculator ,
126
+ $ this ->calculatorMock ,
133
127
$ this ->priceCurrencyMock ,
134
128
null ,
135
129
$ this ->jsonSerializerMock ,
136
130
$ this ->configuredPriceSelectionMock ,
137
131
$ this ->discountCalculatorMock ,
138
132
);
139
- $ this ->model ->setItem ($ this ->itemMock );
140
133
}
141
134
142
135
/**
143
136
* Test of value getter when item presented
144
137
*/
145
138
public function testGetValueMethod (): void
146
139
{
140
+ $ this ->productMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (123 );
141
+ $ this ->itemMock = $ this ->getMockBuilder (ItemInterface::class)
142
+ ->getMock ();
143
+ $ this ->itemMock ->expects ($ this ->any ())->method ('getProduct ' )->willReturn ($ this ->productMock );
144
+ $ this ->model ->setItem ($ this ->itemMock );
147
145
$ valueFromMock = $ this ->model ->getValue ();
148
- $ this ->assertEquals (95. , $ valueFromMock );
146
+ $ this ->assertEquals (95.00 , $ valueFromMock );
149
147
}
150
148
151
149
/**
@@ -162,7 +160,7 @@ public function testGetValueMethodNoItem(): void
162
160
$ this ->productMock ->expects ($ this ->any ())->method ('getId ' )->willReturn (false );
163
161
$ this ->model ->setItem ($ this ->itemMock );
164
162
$ valueFromMock = $ this ->model ->getValue ();
165
- $ this ->assertEquals (100. , $ valueFromMock );
163
+ $ this ->assertEquals (100.00 , $ valueFromMock );
166
164
}
167
165
168
166
/**
0 commit comments