9
9
namespace Magento \WebapiAsync \Model ;
10
10
11
11
use Magento \Catalog \Api \Data \ProductInterface ;
12
- use Magento \Framework \Exception \NotFoundException ;
13
12
use Magento \TestFramework \MessageQueue \PreconditionFailedException ;
14
13
use Magento \TestFramework \MessageQueue \PublisherConsumerController ;
15
14
use Magento \TestFramework \MessageQueue \EnvironmentPreconditionException ;
21
20
use Magento \Framework \Webapi \Exception ;
22
21
use Magento \Catalog \Api \ProductRepositoryInterface ;
23
22
use Magento \Catalog \Api \Data \ProductInterface as Product ;
23
+ use Magento \Framework \ObjectManagerInterface ;
24
+ use Magento \Store \Model \Store ;
25
+ use Magento \Framework \Webapi \Rest \Request ;
24
26
25
27
/**
26
28
* Check async request for multistore product creation service, scheduling bulk
@@ -76,7 +78,7 @@ class AsyncScheduleMultiStoreTest extends WebapiAbstract
76
78
private $ productRepository ;
77
79
78
80
/**
79
- * @var \Magento\Framework\ ObjectManagerInterface
81
+ * @var ObjectManagerInterface
80
82
*/
81
83
private $ objectManager ;
82
84
@@ -92,7 +94,7 @@ protected function setUp()
92
94
$ this ->registry = $ this ->objectManager ->get (Registry::class);
93
95
94
96
$ params = array_merge_recursive (
95
- \ Magento \ TestFramework \ Helper \ Bootstrap::getInstance ()->getAppInitParams (),
97
+ Bootstrap::getInstance ()->getAppInitParams (),
96
98
['MAGE_DIRS ' => ['cache ' => ['path ' => TESTS_TEMP_DIR . '/cache ' ]]]
97
99
);
98
100
@@ -126,8 +128,8 @@ public function testAsyncScheduleBulkMultistore($storeCode)
126
128
$ product = $ this ->getProductData ();
127
129
$ this ->_markTestAsRestOnly ();
128
130
129
- /** @var $store \Magento\Store\Model\Group */
130
- $ store = \ Magento \ TestFramework \ Helper \Bootstrap:: getObjectManager ()-> create (\ Magento \ Store \ Model \ Store::class);
131
+ /** @var Store $store */
132
+ $ store = $ this -> objectManager -> create (Store::class);
131
133
$ store ->load (self ::STORE_CODE_FROM_FIXTURE );
132
134
$ this ->assertEquals (
133
135
self ::STORE_NAME_FROM_FIXTURE ,
@@ -136,9 +138,9 @@ public function testAsyncScheduleBulkMultistore($storeCode)
136
138
);
137
139
138
140
try {
139
- /** @var \Magento\Catalog\Model\ Product $productModel */
140
- $ productModel = Bootstrap:: getObjectManager () ->create (
141
- \ Magento \ Catalog \ Model \ Product::class,
141
+ /** @var Product $productModel */
142
+ $ productModel = $ this -> objectManager ->create (
143
+ Product::class,
142
144
['data ' => $ product ['product ' ]]
143
145
);
144
146
$ this ->productRepository ->save ($ productModel );
@@ -186,7 +188,7 @@ private function asyncScheduleAndTest($product, $storeCode = null)
186
188
$ serviceInfo = [
187
189
'rest ' => [
188
190
'resourcePath ' => self ::REST_RESOURCE_PATH . '/ ' . $ sku ,
189
- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_GET
191
+ 'httpMethod ' => Request::HTTP_METHOD_GET
190
192
]
191
193
];
192
194
$ storeResponse = $ this ->_webApiCall ($ serviceInfo , $ requestData , null , $ checkingStore );
@@ -318,7 +320,7 @@ private function updateProductAsync($requestData, $sku, $storeCode = null)
318
320
$ serviceInfo = [
319
321
'rest ' => [
320
322
'resourcePath ' => self ::ASYNC_RESOURCE_PATH . '/ ' . $ sku ,
321
- 'httpMethod ' => \ Magento \ Framework \ Webapi \ Rest \ Request::HTTP_METHOD_PUT ,
323
+ 'httpMethod ' => Request::HTTP_METHOD_PUT ,
322
324
],
323
325
];
324
326
@@ -343,15 +345,14 @@ public function assertProductCreation($product)
343
345
public static function tearDownAfterClass ()
344
346
{
345
347
parent ::tearDownAfterClass ();
346
- /** @var \Magento\Framework\Registry $registry */
347
- $ registry = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
348
- ->get (\Magento \Framework \Registry::class);
348
+ /** @var Registry $registry */
349
+ $ registry = Bootstrap::getObjectManager ()->get (Registry::class);
349
350
350
351
$ registry ->unregister ('isSecureArea ' );
351
352
$ registry ->register ('isSecureArea ' , true );
352
353
353
- /** @var $store \Magento\ Store\Model\Store */
354
- $ store = \ Magento \ TestFramework \ Helper \ Bootstrap::getObjectManager ()->create (\ Magento \ Store \ Model \ Store::class);
354
+ /** @var Store $store */
355
+ $ store = Bootstrap::getObjectManager ()->create (Store::class);
355
356
$ store ->load ('fixturestore ' );
356
357
if ($ store ->getId ()) {
357
358
$ store ->delete ();
0 commit comments