15
15
use Magento \TestFramework \Helper \Bootstrap ;
16
16
17
17
/**
18
- * Integration tests for shipping carriers.
18
+ * Abstract class for testing shipping carriers.
19
19
*/
20
- class CollectRatesTest extends \PHPUnit \Framework \TestCase
20
+ abstract class CollectRatesAbstract extends \PHPUnit \Framework \TestCase
21
21
{
22
-
23
22
/**
24
23
* @var ObjectManagerInterface
25
24
*/
@@ -45,14 +44,13 @@ class CollectRatesTest extends \PHPUnit\Framework\TestCase
45
44
*/
46
45
protected function setUp ()
47
46
{
48
- if (empty ($ this ->carrier ) || empty ($ this ->errorMessage )) {
49
- $ this ->markTestSkipped ('Required fields are empty ' );
50
- }
51
47
$ this ->objectManager = Bootstrap::getObjectManager ();
52
48
$ this ->shipping = $ this ->objectManager ->get (Shipping::class);
53
49
}
54
50
55
51
/**
52
+ * Tests that an error message is displayed when the shipping method is enabled and not applicable.
53
+ *
56
54
* @return void
57
55
*/
58
56
public function testCollectRatesWhenShippingCarrierIsAvailableAndNotApplicable ()
@@ -65,6 +63,8 @@ public function testCollectRatesWhenShippingCarrierIsAvailableAndNotApplicable()
65
63
}
66
64
67
65
/**
66
+ * Tests that shipping rates don't return when the shipping method is disabled and not applicable.
67
+ *
68
68
* @return void
69
69
*/
70
70
public function testCollectRatesWhenShippingCarrierIsNotAvailableAndNotApplicable ()
@@ -76,6 +76,8 @@ public function testCollectRatesWhenShippingCarrierIsNotAvailableAndNotApplicabl
76
76
}
77
77
78
78
/**
79
+ * Returns customer address.
80
+ *
79
81
* @return DataObject
80
82
*/
81
83
private function getAddress (): DataObject
@@ -102,6 +104,8 @@ private function getAddress(): DataObject
102
104
}
103
105
104
106
/**
107
+ * Returns shipping rate by the result.
108
+ *
105
109
* @param Result $result
106
110
* @return Method|Error
107
111
*/
0 commit comments