Skip to content

Commit

Permalink
Merge pull request magento#2043 from magento-plankton/webapi-fixes-2.1
Browse files Browse the repository at this point in the history
Fixed issues:

- MAGETWO-87346 Uncaught 'undefined property' notices in REST tests - backport for 2.1-develop
- MAGETWO-87348 WebAPI-Tests on 2.1 fails with the exception when running the fixture
- MAGETWO-87343 Uncaught fatal error in SOAP tests
  • Loading branch information
igrybkov authored Feb 5, 2018
2 parents 689f414 + 7062d96 commit 814c791
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
Expand Down Expand Up @@ -412,6 +411,7 @@ public function validOptionDataProvider()
*/
public function testUpdateNegative($optionData, $message, $exceptionCode)
{
$this->_markTestAsRestOnly();
$productSku = 'simple';
/** @var ProductRepository $productRepository */
$productRepository = $this->objectManager->create(ProductRepository::class);
Expand All @@ -424,18 +424,9 @@ public function testUpdateNegative($optionData, $message, $exceptionCode)
'resourcePath' => '/V1/products/options/' . $optionId,
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT,
],
'soap' => [
'service' => self::SERVICE_NAME,
'serviceVersion' => 'V1',
'operation' => self::SERVICE_NAME . 'Save',
],
];

if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
$this->setExpectedException('SoapFault');
} else {
$this->setExpectedException('Exception', $message, $exceptionCode);
}
$this->setExpectedException('Exception', $message, $exceptionCode);
$this->_webApiCall($serviceInfo, ['option' => $optionData]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function tearDown()
$this->assertTrue($response);
}
}
unset($this->accountManagement);
$this->accountManagement = null;
$mediaDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA);
$mediaDirectory->delete(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function setUp()
*/
public function tearDown()
{
unset($this->customerRepository);
$this->customerRepository = null;

/** @var \Magento\Framework\Registry $registry */
$registry = Bootstrap::getObjectManager()->get('Magento\Framework\Registry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public function tearDown()
$this->configValue
);
$this->config->save();
unset($this->accountManagement);
unset($this->subscriber);
$this->accountManagement = null;
$this->subscriber = null;
}

private function initSubscriber()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function tearDown()
$this->assertTrue($response);
}
}
unset($this->customerRepository);
$this->customerRepository = null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class IntegrationTest extends \Magento\TestFramework\TestCase\WebapiAbstract
/** @var \Magento\Integration\Model\Integration */
protected $integration;


protected function setUp()
{
$objectManager = Bootstrap::getObjectManager();
Expand All @@ -32,7 +31,7 @@ protected function setUp()

protected function tearDown()
{
unset($this->integration);
$this->integration = null;
OauthHelper::clearApiAccessCredentials();
parent::tearDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

/** @var $product \Magento\Catalog\Model\Product */
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
$product->load(1);
$product->load(1001);
$product->setAssociatedProductIds([20]);
$product->save();
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testCopyright()
$invoker(
function ($filename) {
$fileText = file_get_contents($filename);
if (strpos($fileText, 'Copyright © 2013-' . date('Y')) === false) {
if (strpos($fileText, 'Copyright © Magento, Inc. All rights reserved.') === false) {
$this->fail('Copyright is missing or has wrong year in ' . $filename);
}
},
Expand Down

0 comments on commit 814c791

Please sign in to comment.