Skip to content

Commit e7d332b

Browse files
committed
Merge remote-tracking branch 'origin/common_phpunit_test' into phpunit10
2 parents 2cc6d47 + c4ddbcc commit e7d332b

File tree

9 files changed

+51
-56
lines changed

9 files changed

+51
-56
lines changed

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: 18 additions & 18 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="dev/tests/integration/allure/allure.config.php"/>
27+
</bootstrap>
3128
</extensions>
3229
</phpunit>

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Event/TransactionTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ protected function _imitateTransactionStartRequest($eventName)
5757
};
5858
$this->_eventManager
5959
->method('fireEvent')
60-
->withConsecutive([$eventName])
6160
->willReturnOnConsecutiveCalls($this->returnCallback($callback));
6261
}
6362

@@ -83,7 +82,6 @@ protected function _imitateTransactionRollbackRequest($eventName)
8382
};
8483
$this->_eventManager
8584
->method('fireEvent')
86-
->withConsecutive([$eventName])
8785
->willReturnOnConsecutiveCalls($this->returnCallback($callback));
8886
}
8987

@@ -115,10 +113,10 @@ public function testStartAndRollbackTransaction($method, $eventName)
115113

116114
$this->_eventManager
117115
->method('fireEvent')
118-
->withConsecutive($eventManagerWithArgs);
116+
->with($eventManagerWithArgs);
119117
}
120118

121-
public function startAndRollbackTransactionDataProvider()
119+
public static function startAndRollbackTransactionDataProvider()
122120
{
123121
return [
124122
'method "startTest"' => ['startTest', 'startTestTransactionRequest'],
@@ -153,7 +151,11 @@ public function testEndTestSuiteRollbackTransaction()
153151
$this->_expectTransactionRollback();
154152
$this->_eventManager
155153
->method('fireEvent')
156-
->withConsecutive(['rollbackTransaction']);
154+
->willReturnCallback(function ($arg) {
155+
if ($arg === 'rollbackTransaction') {
156+
return null;
157+
}
158+
});
157159

158160
$this->_object->endTestSuite();
159161
}

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)