Skip to content

Commit 208e037

Browse files
CE-33707: Added PHPUnit 9.3.0 support for integration tests
1 parent 2cfc83c commit 208e037

File tree

10 files changed

+60
-98
lines changed

10 files changed

+60
-98
lines changed

dev/tests/integration/phpunit.xml.dist

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,26 @@
66
*/
77
-->
88
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.1/phpunit.xsd"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
1010
colors="true"
1111
columns="max"
1212
beStrictAboutTestsThatDoNotTestAnything="false"
1313
bootstrap="./framework/bootstrap.php"
1414
stderr="true"
1515
testSuiteLoaderClass="Magento\TestFramework\SuiteLoader"
16-
testSuiteLoaderFile="framework/Magento/TestFramework/SuiteLoader.php"
17-
>
16+
testSuiteLoaderFile="framework/Magento/TestFramework/SuiteLoader.php">
17+
<coverage>
18+
<include>
19+
<directory suffix=".php">../../../app/code/Magento</directory>
20+
<directory suffix=".php">../../../lib/internal/Magento</directory>
21+
</include>
22+
<exclude>
23+
<directory>../../../app/code/*/*/Test</directory>
24+
<directory>../../../lib/internal/*/*/Test</directory>
25+
<directory>../../../lib/internal/*/*/*/Test</directory>
26+
<directory>../../../setup/src/*/*/Test</directory>
27+
</exclude>
28+
</coverage>
1829
<!-- Test suites definition -->
1930
<testsuites>
2031
<testsuite name="Magento Integration Tests">
@@ -32,18 +43,6 @@
3243
</testsuite>
3344
</testsuites>
3445
<!-- Code coverage filters -->
35-
<filter>
36-
<whitelist>
37-
<directory suffix=".php">../../../app/code/Magento</directory>
38-
<directory suffix=".php">../../../lib/internal/Magento</directory>
39-
<exclude>
40-
<directory>../../../app/code/*/*/Test</directory>
41-
<directory>../../../lib/internal/*/*/Test</directory>
42-
<directory>../../../lib/internal/*/*/*/Test</directory>
43-
<directory>../../../setup/src/*/*/Test</directory>
44-
</exclude>
45-
</whitelist>
46-
</filter>
4746
<!-- PHP INI settings and constants definition -->
4847
<php>
4948
<includePath>.</includePath>

dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTypeTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,9 @@ private function prepareUploaderFactoryMock(): void
650650
$uploaderMock = $this->getPreparedUploader();
651651
/** @var FileTransferFactory $httpFactory */
652652
$httpFactoryMock = $this->createPartialMock(FileTransferFactory::class, ['create']);
653-
$httpFactoryMock->expects($this->at(0))
653+
$httpFactoryMock
654654
->method('create')
655-
->willReturn($uploaderMock);
656-
$httpFactoryMock->expects($this->at(1))
657-
->method('create')
658-
->willReturn(clone $uploaderMock);
655+
->willReturnOnConsecutiveCalls($uploaderMock, clone $uploaderMock);
659656
$this->objectManager->addSharedInstance($httpFactoryMock, FileTransferFactory::class);
660657
}
661658

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/ApplicationDumpCommandTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,12 @@ public function testExecute()
171171
'CONFIG__DEFAULT__WEB__TEST__TEST_SENSITIVE_ENVIRONMENT5 for web/test/test_sensitive_environment5'
172172
]);
173173
$outputMock = $this->getMockForAbstractClass(OutputInterface::class);
174-
$outputMock->expects($this->at(0))
174+
$outputMock
175175
->method('writeln')
176-
->with(['system' => $comment]);
177-
$outputMock->expects($this->at(1))
178-
->method('writeln')
179-
->with($this->matchesRegularExpression('/<info>Done. Config types dumped: [a-z0-9,\s]+<\/info>/'));
180-
176+
->withConsecutive(
177+
[['system' => $comment]],
178+
[$this->matchesRegularExpression('/<info>Done. Config types dumped: [a-z0-9,\s]+<\/info>/')]
179+
);
181180
/** @var ApplicationDumpCommand command */
182181
$command = $this->objectManager->create(ApplicationDumpCommand::class);
183182
$command->run($this->getMockForAbstractClass(InputInterface::class), $outputMock);

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/App/SensitiveConfigSetCommandTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ protected function setUp(): void
9292
public function testExecute($scope, $scopeCode, callable $assertCallback)
9393
{
9494
$outputMock = $this->getMockForAbstractClass(OutputInterface::class);
95-
$outputMock->expects($this->at(0))
95+
$outputMock
9696
->method('writeln')
97-
->with('<info>Configuration value saved in app/etc/env.php</info>');
97+
->withConsecutive(['<info>Configuration value saved in app/etc/env.php</info>']);
9898

9999
$inputMocks = [];
100100

@@ -182,13 +182,12 @@ public function testExecuteInteractive($scope, $scopeCode, callable $assertCallb
182182
$inputMock = $this->createInputMock(null, null, $scope, $scopeCode);
183183

184184
$outputMock = $this->getMockForAbstractClass(OutputInterface::class);
185-
$outputMock->expects($this->at(0))
185+
$outputMock
186186
->method('writeln')
187-
->with('<info>Please set configuration values or skip them by pressing [Enter]:</info>');
188-
$outputMock->expects($this->at(1))
189-
->method('writeln')
190-
->with('<info>Configuration values saved in app/etc/env.php</info>');
191-
187+
->withConsecutive(
188+
['<info>Please set configuration values or skip them by pressing [Enter]:</info>'],
189+
['<info>Configuration values saved in app/etc/env.php</info>']
190+
);
192191
$command = $this->createInteractiveCommand('sensitiveValue');
193192
$command->run($inputMock, $outputMock);
194193

@@ -300,7 +299,7 @@ private function createInputMock($key, $val, $scope, $scopeCode)
300299
{
301300
$inputMock = $this->getMockForAbstractClass(InputInterface::class);
302301
$isInteractive = $key === null;
303-
302+
304303
if (!$isInteractive) {
305304
$inputMock->expects($this->exactly(2))
306305
->method('getArgument')

dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,10 @@ public function testRedisSaveHandlerFallbackToDefaultOnSessionException(): void
113113
->getMock();
114114
$defaultHandlerMock->expects($this->once())->method('open')->with('explicit_save_path', 'test_session_id');
115115

116-
$this->saveHandlerFactoryMock->expects($this->at(0))
116+
$this->saveHandlerFactoryMock
117117
->method('create')
118-
->with('redis')
119-
->willReturn($redisHandlerMock);
120-
$this->saveHandlerFactoryMock->expects($this->at(1))
121-
->method('create')
122-
->with(SaveHandlerInterface::DEFAULT_HANDLER)
123-
->willReturn($defaultHandlerMock);
118+
->withConsecutive(['redis'], [SaveHandlerInterface::DEFAULT_HANDLER])
119+
->willReturnOnConsecutiveCalls($redisHandlerMock, $defaultHandlerMock);
124120

125121
$sessionConfig = $this->objectManager->create(ConfigInterface::class);
126122
/** @var SaveHandler $saveHandler */

dev/tests/integration/testsuite/Magento/Framework/View/Layout/MergeTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,10 @@ public function testLoadCache()
288288
"layout" => self::FIXTURE_LAYOUT_XML
289289
];
290290

291-
$this->_cache->expects($this->at(0))->method('load')
292-
->with('LAYOUT_area_STORE20_100c6a4ccd050e33acef0553f24ef399961_page_layout_merged')
293-
->willReturn(json_encode($cacheValue));
291+
$this->_cache
292+
->method('load')
293+
->withConsecutive(['LAYOUT_area_STORE20_100c6a4ccd050e33acef0553f24ef399961_page_layout_merged'])
294+
->willReturnOnConsecutiveCalls(json_encode($cacheValue));
294295

295296
$this->_serializer->expects($this->once())->method('unserialize')->willReturn($cacheValue);
296297

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,33 +144,24 @@ public function testResolve(string $paymentMethod): void
144144
$paypalRequest['AMT'] = '30.00';
145145
$paypalRequest['SHIPPINGAMT'] = '10.00';
146146

147-
$this->nvpMock
148-
->expects($this->at(0))
149-
->method('call')
150-
->with(Nvp::SET_EXPRESS_CHECKOUT, $paypalRequest)
151-
->willReturn($paypalResponse);
152-
153147
$paypalRequestDetails = [
154148
'TOKEN' => $token,
155149
];
156150

157151
$paypalRequestDetailsResponse = include __DIR__ . '/../../../_files/paypal_set_payer_id_repsonse.php';
158-
159-
$this->nvpMock
160-
->expects($this->at(1))
161-
->method('call')
162-
->with(Nvp::GET_EXPRESS_CHECKOUT_DETAILS, $paypalRequestDetails)
163-
->willReturn($paypalRequestDetailsResponse);
164-
165152
$paypalRequestPlaceOrder = include __DIR__ . '/../../../_files/paypal_place_order_request.php';
166-
167153
$paypalRequestPlaceOrder['EMAIL'] = 'customer@example.com';
168154

169155
$this->nvpMock
170-
->expects($this->at(2))
171156
->method('call')
172-
->with(Nvp::DO_EXPRESS_CHECKOUT_PAYMENT, $paypalRequestPlaceOrder)
173-
->willReturn(
157+
->withConsecutive(
158+
[Nvp::SET_EXPRESS_CHECKOUT, $paypalRequest],
159+
[Nvp::GET_EXPRESS_CHECKOUT_DETAILS, $paypalRequestDetails],
160+
[Nvp::DO_EXPRESS_CHECKOUT_PAYMENT, $paypalRequestPlaceOrder]
161+
)
162+
->willReturnOnConsecutiveCalls(
163+
$paypalResponse,
164+
$paypalRequestDetailsResponse,
174165
[
175166
'RESULT' => '0',
176167
'PNREF' => 'B7PPAC033FF2',
@@ -182,7 +173,7 @@ public function testResolve(string $paymentMethod): void
182173
'PPREF' => '7RK43642T8939154L',
183174
'CORRELATIONID' => $correlationId,
184175
'PAYMENTTYPE' => 'instant',
185-
'PENDINGREASON' => 'authorization',
176+
'PENDINGREASON' => 'authorization'
186177
]
187178
);
188179

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowProTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,9 @@ public function testResolveCustomer(): void
149149
);
150150

151151
$this->gatewayMock
152-
->expects($this->at(0))
153152
->method('postRequest')
154-
->willReturn($paypalResponse);
155-
156-
$this->gatewayMock
157-
->expects($this->at(1))
158-
->method('postRequest')
159-
->willReturn(
153+
->willReturnOnConsecutiveCalls(
154+
$paypalResponse,
160155
new DataObject(
161156
[
162157
'result' => '0',
@@ -176,11 +171,10 @@ public function testResolveCustomer(): void
176171
'expdate' => '0221',
177172
'cardtype' => '0',
178173
'iavs' => 'N',
179-
'result_code' => '0',
174+
'result_code' => '0'
180175
]
181176
)
182177
);
183-
184178
$response = $this->graphQlRequest->send($query, [], '', $requestHeaders);
185179
$responseData = $this->json->unserialize($response->getContent());
186180

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\PaypalGraphQl\PaypalExpressAbstractTest;
1212
use Magento\Framework\Serialize\SerializerInterface;
1313
use Magento\Quote\Model\QuoteIdToMaskedQuoteId;
14-
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1514

1615
/**
1716
* Test ExpressSetPaymentMethodTest graphql endpoint for guest
@@ -132,31 +131,23 @@ public function testResolveGuest(string $paymentMethod): void
132131
$paypalRequest['AMT'] = '30.00';
133132
$paypalRequest['SHIPPINGAMT'] = '10.00';
134133

135-
$this->nvpMock
136-
->expects($this->at(0))
137-
->method('call')
138-
->with(Nvp::SET_EXPRESS_CHECKOUT, $paypalRequest)
139-
->willReturn($paypalResponse);
140-
141134
$paypalRequestDetails = [
142135
'TOKEN' => $token,
143136
];
144137

145138
$paypalRequestDetailsResponse = include __DIR__ . '/../../../_files/paypal_set_payer_id_repsonse.php';
146-
147-
$this->nvpMock
148-
->expects($this->at(1))
149-
->method('call')
150-
->with(Nvp::GET_EXPRESS_CHECKOUT_DETAILS, $paypalRequestDetails)
151-
->willReturn($paypalRequestDetailsResponse);
152-
153139
$paypalRequestPlaceOrder = include __DIR__ . '/../../../_files/paypal_place_order_request.php';
154140

155141
$this->nvpMock
156-
->expects($this->at(2))
157142
->method('call')
158-
->with(Nvp::DO_EXPRESS_CHECKOUT_PAYMENT, $paypalRequestPlaceOrder)
159-
->willReturn(
143+
->withConsecutive(
144+
[Nvp::SET_EXPRESS_CHECKOUT, $paypalRequest],
145+
[Nvp::GET_EXPRESS_CHECKOUT_DETAILS, $paypalRequestDetails],
146+
[Nvp::DO_EXPRESS_CHECKOUT_PAYMENT, $paypalRequestPlaceOrder]
147+
)
148+
->willReturnOnConsecutiveCalls(
149+
$paypalResponse,
150+
$paypalRequestDetailsResponse,
160151
[
161152
'RESULT' => '0',
162153
'PNREF' => 'B7PPAC033FF2',
@@ -168,7 +159,7 @@ public function testResolveGuest(string $paymentMethod): void
168159
'PPREF' => '7RK43642T8939154L',
169160
'CORRELATIONID' => $correlationId,
170161
'PAYMENTTYPE' => 'instant',
171-
'PENDINGREASON' => 'authorization',
162+
'PENDINGREASON' => 'authorization'
172163
]
173164
);
174165

dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalPayflowProSetPaymentMethodTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,9 @@ public function testResolveGuest(): void
139139
);
140140

141141
$this->gatewayMock
142-
->expects($this->at(0))
143142
->method('postRequest')
144-
->willReturn($paypalResponse);
145-
146-
$this->gatewayMock
147-
->expects($this->at(1))
148-
->method('postRequest')
149-
->willReturn(
143+
->willReturnOnConsecutiveCalls(
144+
$paypalResponse,
150145
new DataObject(
151146
[
152147
'result' => '0',
@@ -166,7 +161,7 @@ public function testResolveGuest(): void
166161
'expdate' => '0221',
167162
'cardtype' => '0',
168163
'iavs' => 'N',
169-
'result_code' => '0',
164+
'result_code' => '0'
170165
]
171166
)
172167
);

0 commit comments

Comments
 (0)