Skip to content

Commit 6c59371

Browse files
ShradddhaShradddha
authored andcommitted
AC-11979:: Remove Deprecations- PhpUnit10 Integration Tests
1 parent 0bcbd94 commit 6c59371

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

dev/tests/integration/testsuite/Magento/Framework/Filter/VariableResolver/StrictResolverTest.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,32 @@ protected function setUp(): void
3737
*/
3838
public function testResolve($value, array $variables, $expected)
3939
{
40+
if(str_contains($value, 'foo.email.getUrl'))
41+
{
42+
$variables['store'] = $variables['store']($this);
43+
$variables['foo']['email'] = $variables['foo']['email']($this);
44+
}
4045
$result = $this->variableResolver->resolve($value, $this->filter, $variables);
4146
self::assertSame($expected, $result);
4247
}
4348

44-
public function useCasesProvider()
49+
private function getMockForStoreClass()
50+
{
51+
$storeMock = $this->createMock(\Magento\Store\Model\Store::class);
52+
return $storeMock;
53+
}
54+
55+
public function getMockForEmailTemplate($storeMock)
56+
{
57+
$mock = $storeMock($this);
58+
$emailTemplate = $this->createMock(\Magento\Email\Model\Template::class);
59+
$emailTemplate->method('getUrl')
60+
->with($mock, 'some path', ['_query' => ['id' => 'abc', 'token' => 'abc'], 'abc' => '1'])
61+
->willReturn('a url');
62+
return $emailTemplate;
63+
}
64+
65+
public static function useCasesProvider()
4566
{
4667
$classStub = new class {
4768
public function doThing()
@@ -65,11 +86,8 @@ public function getThing()
6586
};
6687
$dataClassStub->setData('foo', 'bar');
6788

68-
$storeMock = $this->createMock(\Magento\Store\Model\Store::class);
69-
$emailTemplate = $this->createMock(\Magento\Email\Model\Template::class);
70-
$emailTemplate->method('getUrl')
71-
->with($storeMock, 'some path', ['_query' => ['id' => 'abc', 'token' => 'abc'], 'abc' => '1'])
72-
->willReturn('a url');
89+
$storeMock = static fn (self $testCase) => $testCase->getMockForStoreClass();
90+
$emailTemplate = static fn (self $testCase) => $testCase->getMockForEmailTemplate($storeMock);;
7391

7492
return [
7593
['', [], null],

dev/tests/integration/testsuite/Magento/Framework/ObjectManager/ResetAfterRequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function setUp(): void
5757
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
5858
* @SuppressWarnings(PHPMD.NPathComplexity)
5959
*/
60-
public function resetAfterRequestClassDataProvider()
60+
public static function resetAfterRequestClassDataProvider()
6161
{
6262
$resetAfterRequestClasses = [];
6363
foreach (Classes::getVirtualClasses() as $name => $type) {

dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/CsvfileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testDisplay($statFile, $expectedFile, $delimiter = ',', $enclosu
4646
/**
4747
* @return array
4848
*/
49-
public function displayDataProvider()
49+
public static function displayDataProvider()
5050
{
5151
return [
5252
'Default delimiter & enclosure' => [

dev/tests/integration/testsuite/Magento/Framework/Profiler/Driver/Standard/Output/HtmlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testDisplay($statFile, $expectedHtmlFile)
4141
/**
4242
* @return array
4343
*/
44-
public function displayDataProvider()
44+
public static function displayDataProvider()
4545
{
4646
return [
4747
['statFile' => __DIR__ . '/_files/timers.php', 'expectedHtmlFile' => __DIR__ . '/_files/output.html']

0 commit comments

Comments
 (0)