Skip to content

Commit 6695c5e

Browse files
authored
Merge pull request #73 from magento-commerce/1.1-develop-phpunit9
MC-38769: PHPUnit 9 support for PHP 2.3.x
2 parents c86a881 + 7760d39 commit 6695c5e

File tree

181 files changed

+341
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+341
-314
lines changed

Inventory/Test/Integration/CreateStockTableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CreateStockTableTest extends TestCase
2929
/**
3030
* @inheritDoc
3131
*/
32-
protected function setUp()
32+
protected function setUp(): void
3333
{
3434
parent::setUp();
3535

Inventory/Test/Integration/GetSourceCodesBySkusTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GetSourceCodesBySkusTest extends TestCase
1818
*/
1919
private $getSourceCodesBySkus;
2020

21-
protected function setUp()
21+
protected function setUp(): void
2222
{
2323
parent::setUp();
2424

Inventory/Test/Integration/Source/Validator/CodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CodeValidatorTest extends TestCase
2525
*/
2626
private $sourceFactory;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
parent::setUp();
3131

@@ -56,7 +56,7 @@ public function testValidation($sourceCode, $errorCount, $errorStrings)
5656
$errors = $result->getErrors();
5757
foreach ($errorStrings as $errorString) {
5858
$errorText = array_shift($errors);
59-
$this->assertContains($errorString, (string)$errorText);
59+
$this->assertStringContainsString($errorString, (string)$errorText);
6060
}
6161
}
6262

Inventory/Test/Integration/Source/Validator/NameValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NameValidatorTest extends TestCase
2525
*/
2626
private $sourceFactory;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
parent::setUp();
3131

@@ -56,7 +56,7 @@ public function testValidation($value, $errorCount, $errorStrings)
5656
$errors = $result->getErrors();
5757
foreach ($errorStrings as $errorString) {
5858
$errorText = array_shift($errors);
59-
$this->assertContains($errorString, (string)$errorText);
59+
$this->assertStringContainsString($errorString, (string)$errorText);
6060
}
6161
}
6262

Inventory/Test/Integration/Stock/StockSourceLinkProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class StockSourceLinkProcessorTest extends TestCase
5151
/**
5252
* @inheritdoc
5353
*/
54-
protected function setUp()
54+
protected function setUp(): void
5555
{
5656
$objectManager = Bootstrap::getObjectManager();
5757
$this->searchCriteriaBuilder = $objectManager->get(SearchCriteriaBuilder::class);
@@ -61,7 +61,7 @@ protected function setUp()
6161
$this->auth = $objectManager->get(Auth::class);
6262
}
6363

64-
protected function tearDown()
64+
protected function tearDown(): void
6565
{
6666
$this->auth->logout();
6767
parent::tearDown();

Inventory/Test/Unit/Model/SourceRepositoryTest.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@
2222
class SourceRepositoryTest extends TestCase
2323
{
2424
/**
25-
* @var SaveInterface|\PHPUnit_Framework_MockObject_MockObject
25+
* @var SaveInterface|\PHPUnit\Framework\MockObject\MockObject
2626
*/
2727
private $commandSave;
2828

2929
/**
30-
* @var GetInterface|\PHPUnit_Framework_MockObject_MockObject
30+
* @var GetInterface|\PHPUnit\Framework\MockObject\MockObject
3131
*/
3232
private $commandGet;
3333

3434
/**
35-
* @var GetListInterface|\PHPUnit_Framework_MockObject_MockObject
35+
* @var GetListInterface|\PHPUnit\Framework\MockObject\MockObject
3636
*/
3737
private $commandGetList;
3838

3939
/**
40-
* @var SourceInterface|\PHPUnit_Framework_MockObject_MockObject
40+
* @var SourceInterface|\PHPUnit\Framework\MockObject\MockObject
4141
*/
4242
private $source;
4343

4444
/**
45-
* @var SourceSearchResultsInterface|\PHPUnit_Framework_MockObject_MockObject
45+
* @var SourceSearchResultsInterface|\PHPUnit\Framework\MockObject\MockObject
4646
*/
4747
private $searchResult;
4848

@@ -51,7 +51,7 @@ class SourceRepositoryTest extends TestCase
5151
*/
5252
private $sourceRepository;
5353

54-
protected function setUp()
54+
protected function setUp(): void
5555
{
5656
$this->commandSave = $this->getMockBuilder(SaveInterface::class)->getMock();
5757
$this->commandGet = $this->getMockBuilder(GetInterface::class)->getMock();
@@ -83,11 +83,12 @@ public function testSave()
8383
}
8484

8585
/**
86-
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
87-
* @expectedExceptionMessage Some error
8886
*/
8987
public function testSaveWithCouldNotSaveException()
9088
{
89+
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class);
90+
$this->expectExceptionMessage('Some error');
91+
9192
$this->commandSave
9293
->expects($this->once())
9394
->method('execute')
@@ -111,11 +112,12 @@ public function testGet()
111112
}
112113

113114
/**
114-
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
115-
* @expectedExceptionMessage Some error
116115
*/
117116
public function testGetWithNoSuchEntityException()
118117
{
118+
$this->expectException(\Magento\Framework\Exception\NoSuchEntityException::class);
119+
$this->expectExceptionMessage('Some error');
120+
119121
$sourceCode = 'source-code';
120122

121123
$this->commandGet

InventoryAdminUi/Test/Integration/Controller/Adminhtml/Source/SaveTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SaveTest extends AbstractBackendController
2929
/**
3030
* @inheritDoc
3131
*/
32-
protected function setUp()
32+
protected function setUp(): void
3333
{
3434
parent::setUp();
3535
$this->controller = $this->_objectManager->get(Save::class);

InventoryAdminUi/Test/Integration/Ui/Component/SourceListingTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public function testPrepareUserHasAllPermissions(): void
9797
);
9898

9999
$resultBlock = $this->processUiComponent();
100-
$this->assertContains('"Enable"', $resultBlock->toHtml());
101-
$this->assertContains('"Edit","hidden":false', $resultBlock->toHtml());
100+
$this->assertStringContainsString('"Enable"', $resultBlock->toHtml());
101+
$this->assertStringContainsString('"Edit","hidden":false', $resultBlock->toHtml());
102102
}
103103

104104
/**
@@ -113,8 +113,8 @@ public function testPrepareUserWithRestrictedRole(): void
113113
\Magento\TestFramework\Bootstrap::ADMIN_PASSWORD
114114
);
115115
$resultBlock = $this->processUiComponent();
116-
$this->assertNotContains('"Enable"', $resultBlock->toHtml());
117-
$this->assertContains('"Edit","hidden":true', $resultBlock->toHtml());
116+
$this->assertStringNotContainsString('"Enable"', $resultBlock->toHtml());
117+
$this->assertStringContainsString('"Edit","hidden":true', $resultBlock->toHtml());
118118
}
119119

120120
/**

InventoryAdminUi/Test/Integration/Ui/Component/StocksListingTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public function testPrepareUserHasAllPermissions(): void
9898
$resultBlock = $this->processUiComponent();
9999
$resultHtml = $resultBlock->toHtml();
100100

101-
$this->assertContains('"Delete"', $resultHtml);
102-
$this->assertContains('"Edit","hidden":false', $resultHtml);
101+
$this->assertStringContainsString('"Delete"', $resultHtml);
102+
$this->assertStringContainsString('"Edit","hidden":false', $resultHtml);
103103
}
104104

105105
/**
@@ -116,8 +116,8 @@ public function testPrepareUserWithRestrictedRole(): void
116116
$resultBlock = $this->processUiComponent();
117117
$resultHtml = $resultBlock->toHtml();
118118

119-
$this->assertNotContains('"Delete"', $resultHtml);
120-
$this->assertContains('"Edit","hidden":true', $resultHtml);
119+
$this->assertStringNotContainsString('"Delete"', $resultHtml);
120+
$this->assertStringContainsString('"Edit","hidden":true', $resultHtml);
121121
}
122122

123123
/**

InventoryAdminUi/Test/Mftf/Test/AdminApplyNotifyQtyUseDefaultDownloadableProductCustomStockTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<waitForPageLoad stepKey="waitForProductPageLoad"/>
2828
<!--Verify Notify Quantity has changed.-->
2929
<dontSeeCheckboxIsChecked selector="{{AdminProductSourcesGrid.rowNotifyQuantityUseDefault('0')}}" stepKey="verifyNotifyQuantityUseDefaultIsNotUsed"/>
30-
<seeInField selector="{{AdminProductSourcesGrid.rowNotifyQuantity('0')}}" userInput="95" stepKey="verifyNotifyQuantityValue"/>
30+
<seeInField selector="{{AdminProductSourcesGrid.rowNotifyQuantity('0')}}" userInput="95.0000" stepKey="verifyNotifyQuantityValue"/>
3131
<!--Resume to Notify Quantity 'Use Default'.-->
3232
<checkOption selector="{{AdminProductSourcesGrid.rowNotifyQuantityUseDefault('0')}}" stepKey="checkNotifyQtyUseDefault"/>
3333
<click selector="{{AdminProductFormSection.save}}" stepKey="saveProductAfterNotifyQuantitySetToUseDefault"/>

0 commit comments

Comments
 (0)