Skip to content

Commit 49655e0

Browse files
committed
PHPUnit version update and minor fixes
1 parent 3763b88 commit 49655e0

File tree

10 files changed

+484
-654
lines changed

10 files changed

+484
-654
lines changed

app/code/Magento/SampleData/Test/Unit/Console/Command/AbstractSampleDataCommandTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function setUp(): void
7373
$this->filesystemMock = $this->createMock(Filesystem::class);
7474
$this->sampleDataDependencyMock = $this->createMock(Dependency::class);
7575
$this->arrayInputFactoryMock = $this->createMock(ArrayInputFactory::class);
76-
$this->applicationMock = $this->createMock(Application::class);
76+
$this->applicationMock = $this->getMockBuilder(Application::class)->getMock();
7777
$this->applicationFactoryMock = $this->createPartialMock(ApplicationFactory::class, ['create']);
7878
}
7979

app/code/Magento/SampleData/Test/Unit/Console/Command/SampleDataRemoveCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testExecuteWithNoUpdate(
7777
*
7878
* @return array
7979
*/
80-
public function processDataProvider(): array
80+
public static function processDataProvider(): array
8181
{
8282
return [
8383
'No sample data found in require' => [

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108
},
109109
"repositories": [
110110
{
111-
"type" : "vcs",
112-
"url" : "[email protected]:magento-gl/magento2-functional-testing-framework.git"
111+
"type": "vcs",
112+
"url": "[email protected]:magento-gl/magento2-functional-testing-framework.git"
113113
}
114114
],
115115
"suggest": {

composer.lock

Lines changed: 456 additions & 619 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/integration/framework/tests/unit/phpunit.xml.dist

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
1010
colors="true"
1111
columns="max"
1212
beStrictAboutTestsThatDoNotTestAnything="false"
@@ -21,12 +21,9 @@
2121
<ini name="date.timezone" value="America/Los_Angeles"/>
2222
</php>
2323
<extensions>
24-
<extension class="Qameta\Allure\PHPUnit\AllureExtension">
25-
<!-- Optional arguments block; omit it if you want to use default values -->
26-
<arguments>
27-
<!-- Path to config file (default is config/allure.config.php) -->
28-
<string>../../../allure/allure.config.php</string>
29-
</arguments>
30-
</extension>
24+
<bootstrap class="Qameta\Allure\PHPUnit\AllureExtension">
25+
<!-- Path to config file (default is config/allure.config.php) -->
26+
<parameter name="config" value="../../../allure/allure.config.php"/>
27+
</bootstrap>
3128
</extensions>
3229
</phpunit>

dev/tests/static/phpunit.xml.dist

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
*/
99
-->
1010
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
12-
colors="true"
13-
columns="max"
11+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
12+
colors="true" columns="max"
1413
beStrictAboutTestsThatDoNotTestAnything="false"
1514
bootstrap="./framework/bootstrap.php">
1615
<testsuites>
@@ -41,12 +40,9 @@
4140
<!--<const name="TESTS_COMPOSER_PATH" value="/usr/local/bin/composer"/>-->
4241
</php>
4342
<extensions>
44-
<extension class="Qameta\Allure\PHPUnit\AllureExtension">
45-
<!-- Optional arguments block; omit it if you want to use default values -->
46-
<arguments>
47-
<!-- Path to config file (default is config/allure.config.php) -->
48-
<string>allure/allure.config.php</string>
49-
</arguments>
50-
</extension>
43+
<bootstrap class="Qameta\Allure\PHPUnit\AllureExtension">
44+
<!-- Path to config file (default is config/allure.config.php) -->
45+
<parameter name="config" value="allure/allure.config.php" />
46+
</bootstrap>
5147
</extensions>
5248
</phpunit>

lib/internal/Magento/Framework/App/Test/Unit/Utility/AggregateInvokerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use PHPUnit\Framework\ExpectationFailedException;
1313
use PHPUnit\Framework\IncompleteTestError;
1414
use PHPUnit\Framework\MockObject\MockObject;
15-
use PHPUnit\Framework\SkippedTestSuiteError as SkippedTestError;
15+
use PHPUnit\Framework\SkippedWithMessageException as SkippedTestError;
1616
use PHPUnit\Framework\Test;
1717
use PHPUnit\Framework\TestCase;
1818

@@ -65,7 +65,7 @@ function () use ($exceptionClass) {
6565
/**
6666
* @return array
6767
*/
68-
public function callbackDataProvider()
68+
public static function callbackDataProvider()
6969
{
7070
return [
7171
[

lib/internal/Magento/Framework/App/Utility/AggregateInvoker.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __invoke(callable $callback, array $dataSource)
4848
{
4949
$results = [
5050
\PHPUnit\Framework\IncompleteTestError::class => [],
51-
\PHPUnit\Framework\SkippedTestError::class => [],
51+
\PHPUnit\Framework\SkippedWithMessageException::class => [],
5252
\PHPUnit\Framework\AssertionFailedError::class => [],
5353
];
5454
$passed = 0;
@@ -58,7 +58,7 @@ public function __invoke(callable $callback, array $dataSource)
5858
$passed++;
5959
} catch (\PHPUnit\Framework\IncompleteTestError $exception) {
6060
$results[get_class($exception)][] = $this->prepareMessage($exception, $dataSetName, $dataSet);
61-
} catch (\PHPUnit\Framework\SkippedTestError $exception) {
61+
} catch (\PHPUnit\Framework\SkippedWithMessageException $exception) {
6262
$results[get_class($exception)][] = $this->prepareMessage($exception, $dataSetName, $dataSet);
6363
} catch (\PHPUnit\Framework\AssertionFailedError $exception) {
6464
$results[\PHPUnit\Framework\AssertionFailedError::class][] = $this->prepareMessage(
@@ -86,7 +86,7 @@ protected function prepareMessage(\Exception $exception, $dataSetName, $dataSet)
8686
}
8787
if ($exception instanceof \PHPUnit\Framework\AssertionFailedError
8888
&& !$exception instanceof \PHPUnit\Framework\IncompleteTestError
89-
&& !$exception instanceof \PHPUnit\Framework\SkippedTestError
89+
&& !$exception instanceof \PHPUnit\Framework\SkippedWithMessageException
9090
|| $this->_options['verbose']) {
9191
$dataSetName = 'Data set: ' . $dataSetName . PHP_EOL;
9292
} else {
@@ -110,7 +110,7 @@ protected function processResults(array $results, $passed)
110110
$passed,
111111
count($results[\PHPUnit\Framework\AssertionFailedError::class]),
112112
count($results[\PHPUnit\Framework\IncompleteTestError::class]),
113-
count($results[\PHPUnit\Framework\SkippedTestError::class])
113+
count($results[\PHPUnit\Framework\SkippedWithMessageException::class])
114114
);
115115
if ($results[\PHPUnit\Framework\AssertionFailedError::class]) {
116116
$this->_testCase->fail(
@@ -119,19 +119,19 @@ protected function processResults(array $results, $passed)
119119
);
120120
}
121121
if (!$results[\PHPUnit\Framework\IncompleteTestError::class] &&
122-
!$results[\PHPUnit\Framework\SkippedTestError::class]) {
122+
!$results[\PHPUnit\Framework\SkippedWithMessageException::class]) {
123123
return;
124124
}
125125
$message = $totalCountsMessage . PHP_EOL . implode(
126126
PHP_EOL,
127127
$results[\PHPUnit\Framework\IncompleteTestError::class]
128128
) . PHP_EOL . implode(
129129
PHP_EOL,
130-
$results[\PHPUnit\Framework\SkippedTestError::class]
130+
$results[\PHPUnit\Framework\SkippedWithMessageException::class]
131131
);
132132
if ($results[\PHPUnit\Framework\IncompleteTestError::class]) {
133133
$this->_testCase->markTestSkipped($message);
134-
} elseif ($results[\PHPUnit\Framework\SkippedTestError::class]) {
134+
} elseif ($results[\PHPUnit\Framework\SkippedWithMessageException::class]) {
135135
$this->_testCase->markTestSkipped($message);
136136
}
137137
}

setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/DirectoryScannerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function testScan()
4343
'php' => [
4444
$this->_testDir . '/additional.php',
4545
$this->_testDir . '/app/bootstrap.php',
46-
$this->_testDir . '/app/code/Magento/SomeModule/Helper/Test.php',
47-
$this->_testDir . '/app/code/Magento/SomeModule/Model/Test.php',
46+
$this->_testDir . '/app/code/Magento/SomeModule/Helper/TestHelper.php',
47+
$this->_testDir . '/app/code/Magento/SomeModule/Model/TestHelper.php',
4848
],
4949
'config' => [
5050
$this->_testDir . '/app/code/Magento/SomeModule/etc/adminhtml/system.xml',

setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Scanner/PhpScannerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Magento\Framework\Reflection\TypeProcessor;
1111

12-
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/Test.php';
12+
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Helper/TestHelper.php';
1313
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/ElementFactory.php';
1414
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Model/DoubleColon.php';
1515
require_once __DIR__ . '/../../_files/app/code/Magento/SomeModule/Api/Data/SomeInterface.php';
@@ -63,7 +63,7 @@ protected function setUp(): void
6363
public function testCollectEntities(): void
6464
{
6565
$testFiles = [
66-
$this->testDir . '/app/code/Magento/SomeModule/Helper/Test.php',
66+
$this->testDir . '/app/code/Magento/SomeModule/Helper/TestHelper.php',
6767
$this->testDir . '/app/code/Magento/SomeModule/Model/DoubleColon.php',
6868
$this->testDir . '/app/code/Magento/SomeModule/Api/Data/SomeInterface.php',
6969
$this->testDir . '/app/code/Magento/SomeModule/Model/StubWithAnonymousClass.php'

0 commit comments

Comments
 (0)