Skip to content

Commit 565032d

Browse files
committed
MAGETWO-61829: SOAP/REST tests fail on develop branch but builds are green
2 parents 9784cfc + a90893c commit 565032d

File tree

6 files changed

+71
-40
lines changed

6 files changed

+71
-40
lines changed

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ public function validOptionDataProvider()
391391
*/
392392
public function testUpdateNegative($optionData, $message)
393393
{
394+
$this->_markTestAsRestOnly();
394395
$productSku = 'simple';
395396
/** @var ProductRepository $productRepository */
396397
$productRepository = $this->objectManager->create(ProductRepository::class);
@@ -403,18 +404,9 @@ public function testUpdateNegative($optionData, $message)
403404
'resourcePath' => '/V1/products/options/' . $optionId,
404405
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
405406
],
406-
'soap' => [
407-
'service' => self::SERVICE_NAME,
408-
'serviceVersion' => 'V1',
409-
'operation' => self::SERVICE_NAME . 'Save',
410-
],
411407
];
412408

413-
if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
414-
$this->setExpectedException('SoapFault');
415-
} else {
416-
$this->setExpectedException('Exception', $message, 400);
417-
}
409+
$this->setExpectedException('Exception', $message, 400);
418410
$this->_webApiCall($serviceInfo, ['option' => $optionData]);
419411
}
420412

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,6 @@ public function productCreationProvider()
134134
];
135135
}
136136

137-
private function markAreaAsSecure()
138-
{
139-
/** @var \Magento\Framework\Registry $registry */
140-
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
141-
->get(\Magento\Framework\Registry::class);
142-
$registry->unregister("isSecureArea");
143-
$registry->register("isSecureArea", true);
144-
}
145-
146137
/**
147138
* Test removing association between product and website 1
148139
* @magentoApiDataFixture Magento/Catalog/_files/product_with_two_websites.php
@@ -169,9 +160,6 @@ public function testUpdateWithDeleteWebsites()
169160
$response[ProductInterface::EXTENSION_ATTRIBUTES_KEY]["website_ids"],
170161
$websitesData["website_ids"]
171162
);
172-
$this->deleteProduct($productBuilder[ProductInterface::SKU]);
173-
$this->markAreaAsSecure();
174-
$website->delete();
175163
}
176164

177165
/**
@@ -198,9 +186,6 @@ public function testDeleteAllWebsiteAssociations()
198186
$response[ProductInterface::EXTENSION_ATTRIBUTES_KEY]["website_ids"],
199187
$websitesData["website_ids"]
200188
);
201-
$this->deleteProduct($productBuilder[ProductInterface::SKU]);
202-
$this->markAreaAsSecure();
203-
$website->delete();
204189
}
205190

206191
/**
@@ -222,7 +207,7 @@ public function testCreateWithMultipleWebsites()
222207
$websitesData = [
223208
'website_ids' => [
224209
1,
225-
$website->getId(),
210+
(int) $website->getId(),
226211
]
227212
];
228213
$productBuilder[ProductInterface::EXTENSION_ATTRIBUTES_KEY] = $websitesData;
@@ -231,9 +216,6 @@ public function testCreateWithMultipleWebsites()
231216
$response[ProductInterface::EXTENSION_ATTRIBUTES_KEY]["website_ids"],
232217
$websitesData["website_ids"]
233218
);
234-
$this->deleteProduct($productBuilder[ProductInterface::SKU]);
235-
$this->markAreaAsSecure();
236-
$website->delete();
237219
}
238220

239221
/**

dev/tests/integration/testsuite/Magento/Catalog/_files/product_with_two_websites.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,23 @@
99
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
1010
/** @var Magento\Store\Model\Website $website */
1111
$website = $objectManager->get(Magento\Store\Model\Website::class);
12-
$website->load('second_website', 'code');
1312

14-
if (!$website->getId()) {
15-
$website->setData(
16-
[
17-
'code' => 'second_website',
18-
'name' => 'Test Website',
19-
]
20-
);
13+
$website->setData(
14+
[
15+
'code' => 'second_website',
16+
'name' => 'Test Website',
17+
]
18+
);
2119

22-
$website->save();
23-
}
20+
$website->save();
21+
22+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
2423

2524
/** @var $product \Magento\Catalog\Model\Product */
2625
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
2726
->create(ProductInterface::class);
2827
$product
2928
->setTypeId('simple')
30-
->setId(1)
3129
->setAttributeSetId(4)
3230
->setWebsiteIds([1, $website->getId()])
3331
->setName('Simple Product')
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Catalog\Api\Data\ProductInterface;
8+
9+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
10+
11+
/** @var \Magento\Framework\Registry $registry */
12+
$registry = $objectManager
13+
->get(\Magento\Framework\Registry::class);
14+
$registry->unregister("isSecureArea");
15+
$registry->register("isSecureArea", true);
16+
17+
/** @var Magento\Store\Model\Website $website */
18+
$website = $objectManager->create(\Magento\Store\Model\Website::class);
19+
$website->load('second_website');
20+
$website->delete();
21+
22+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
23+
$productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
24+
25+
try {
26+
$firstProduct = $productRepository->get('unique-simple-azaza');
27+
$firstProduct->delete();
28+
} catch (\Magento\Framework\Exception\NoSuchEntityException $exception) {
29+
//Product already removed
30+
}
31+
32+
$registry->unregister('isSecureArea');
33+
$registry->register('isSecureArea', false);
34+
35+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();

dev/tests/integration/testsuite/Magento/Catalog/_files/second_website.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@
1919

2020
$website->save();
2121
}
22+
23+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry');
8+
$registry->unregister('isSecureArea');
9+
$registry->register('isSecureArea', true);
10+
11+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
12+
$website = $objectManager->get(Magento\Store\Model\Website::class);
13+
$website->load('test_website', 'code');
14+
15+
if ($website->getId()) {
16+
$website->delete();
17+
}
18+
19+
$registry->unregister('isSecureArea');
20+
$registry->register('isSecureArea', false);
21+
22+
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();

0 commit comments

Comments
 (0)