Skip to content

Commit 0edfcec

Browse files
committed
ACQE-5710 : Deprecation error Fix
1 parent 3098953 commit 0edfcec

File tree

8 files changed

+28
-31
lines changed

8 files changed

+28
-31
lines changed

dev/tests/_bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
foreach ($TEST_ENVS as $key => $value) {
3838
$_ENV[$key] = $value;
39-
putenv("{$key}=${value}");
39+
putenv("{$key}={$value}");
4040
}
4141

4242
// Add our test module to the allowlist

dev/tests/unit/Util/TestLoggingUtil.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Monolog\Handler\TestHandler;
1313
use PHPUnit\Framework\TestCase;
1414
use ReflectionProperty;
15+
use ReflectionClass;
1516

1617
class TestLoggingUtil extends TestCase
1718
{
@@ -64,7 +65,7 @@ public function setMockLoggingUtil(): void
6465

6566
$property = new ReflectionProperty(LoggingUtil::class, 'instance');
6667
$property->setAccessible(true);
67-
$property->setValue($mockLoggingUtil);
68+
$property->setValue(null, $mockLoggingUtil);
6869
}
6970

7071
/**
@@ -122,8 +123,7 @@ public function validateMockLogStatmentRegex(string $type, string $regex, array
122123
*/
123124
public function clearMockLoggingUtil(): void
124125
{
125-
$property = new ReflectionProperty(LoggingUtil::class, 'instance');
126-
$property->setAccessible(true);
127-
$property->setValue(null);
126+
$reflectionClass = new ReflectionClass(LoggingUtil::class);
127+
$reflectionClass->setStaticPropertyValue('instance', null);
128128
}
129129
}

dev/tests/verification/Tests/ResilientGenerationTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ public function setUp(): void
7676

7777
$property = new \ReflectionProperty(SuiteGenerator::class, "instance");
7878
$property->setAccessible(true);
79-
$property->setValue(null);
79+
$property->setValue(null,null);
8080

8181
$property = new \ReflectionProperty(DirSetupUtil::class, "DIR_CONTEXT");
8282
$property->setAccessible(true);
83-
$property->setValue([]);
83+
$property->setValue(null, []);
8484

8585
$property = new \ReflectionProperty(SuiteObjectHandler::class, "instance");
8686
$property->setAccessible(true);
87-
$property->setValue(null);
87+
$property->setValue(null, null);
8888

8989
$property = new \ReflectionProperty(TestObjectHandler::class, "testObjectHandler");
9090
$property->setAccessible(true);
91-
$property->setValue(null);
91+
$property->setValue(null, null);
9292
}
9393

9494
/**
@@ -261,19 +261,19 @@ public function tearDown(): void
261261

262262
$property = new \ReflectionProperty(SuiteGenerator::class, "instance");
263263
$property->setAccessible(true);
264-
$property->setValue(null);
264+
$property->setValue(null, null);
265265

266266
$property = new \ReflectionProperty(DirSetupUtil::class, "DIR_CONTEXT");
267267
$property->setAccessible(true);
268-
$property->setValue([]);
268+
$property->setValue(null, []);
269269

270270
$property = new \ReflectionProperty(SuiteObjectHandler::class, "instance");
271271
$property->setAccessible(true);
272-
$property->setValue(null);
272+
$property->setValue(null, null);
273273

274274
$property = new \ReflectionProperty(TestObjectHandler::class, "testObjectHandler");
275275
$property->setAccessible(true);
276-
$property->setValue(null);
276+
$property->setValue(null, null);
277277
}
278278

279279
/**

dev/tests/verification/Tests/StaticCheck/DeprecationStaticCheckTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use ReflectionProperty;
1111
use Symfony\Component\Console\Input\InputInterface;
1212
use tests\util\MftfStaticTestCase;
13+
use ReflectionClass;
1314

1415
class DeprecationStaticCheckTest extends MftfStaticTestCase
1516
{
@@ -33,10 +34,8 @@ public function testDeprecatedEntityUsageCheck()
3334
$staticCheck = new DeprecatedEntityUsageCheck();
3435

3536
$input = $this->mockInputInterface(self::TEST_MODULE_PATH);
36-
$property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath');
37-
$property->setAccessible(true);
38-
$property->setValue(self::STATIC_RESULTS_DIR);
39-
37+
$reflectionClass = new ReflectionClass(StaticChecksList::class);
38+
$reflectionClass->setStaticPropertyValue('errorFilesPath', self::STATIC_RESULTS_DIR);
4039
/** @var InputInterface $input */
4140
$staticCheck->execute($input);
4241

@@ -55,8 +54,7 @@ public function testDeprecatedEntityUsageCheck()
5554
*/
5655
public function tearDown(): void
5756
{
58-
$property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath');
59-
$property->setAccessible(true);
60-
$property->setValue(null);
57+
$reflectionClass = new ReflectionClass(StaticChecksList::class);
58+
$reflectionClass->setStaticPropertyValue('errorFilesPath', null);
6159
}
6260
}

dev/tests/verification/Tests/StaticCheck/PauseActionStaticCheckTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
use Exception;
99
use Magento\FunctionalTestingFramework\StaticCheck\PauseActionUsageCheck;
1010
use Magento\FunctionalTestingFramework\StaticCheck\StaticChecksList;
11+
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
1112
use ReflectionProperty;
1213
use Symfony\Component\Console\Input\InputInterface;
1314
use tests\util\MftfStaticTestCase;
15+
use ReflectionClass;
1416

1517
class PauseActionStaticCheckTest extends MftfStaticTestCase
1618
{
@@ -34,10 +36,8 @@ public function testPauseActionUsageCheck()
3436
$staticCheck = new PauseActionUsageCheck();
3537

3638
$input = $this->mockInputInterface(self::TEST_MODULE_PATH);
37-
38-
$property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath');
39-
$property->setAccessible(true);
40-
$property->setValue(self::STATIC_RESULTS_DIR);
39+
$reflectionClass = new ReflectionClass(StaticChecksList::class);
40+
$reflectionClass->setStaticPropertyValue('errorFilesPath', self::STATIC_RESULTS_DIR);
4141

4242
/** @var InputInterface $input */
4343
$staticCheck->execute($input);
@@ -57,8 +57,7 @@ public function testPauseActionUsageCheck()
5757
*/
5858
public static function tearDownAfterClass(): void
5959
{
60-
$property = new ReflectionProperty(StaticChecksList::class, 'errorFilesPath');
61-
$property->setAccessible(true);
62-
$property->setValue(null);
60+
$reflectionClass = new ReflectionClass(StaticChecksList::class);
61+
$reflectionClass->setStaticPropertyValue('errorFilesPath', null);
6362
}
6463
}

dev/tests/verification/Tests/SuiteGenerationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ public function tearDown(): void
493493

494494
$property = new \ReflectionProperty(DirSetupUtil::class, "DIR_CONTEXT");
495495
$property->setAccessible(true);
496-
$property->setValue([]);
496+
$property->setValue(null, []);
497497
}
498498

499499
/**

src/Magento/FunctionalTestingFramework/Util/Logger/LoggingUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public static function getInstance(): LoggingUtil
3636
if (self::$instance === null) {
3737
self::$instance = new LoggingUtil();
3838
}
39-
4039
return self::$instance;
4140
}
4241

42+
4343
/**
4444
* Avoids instantiation of LoggingUtil by new.
4545
* @return void

src/Magento/FunctionalTestingFramework/Util/Sorter/ParallelGroupSorter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,8 @@ private function splitTestSuite($suiteName, $tests, $maxTime)
487487
}
488488

489489
$group = $this->createTestGroup($maxTime, $test, $size, $availableTests);
490-
$splitSuites["{$suiteName}_${splitCount}_G"] = $group;
491-
$this->addSuiteToConfig($suiteName, "{$suiteName}_${splitCount}_G", $group);
490+
$splitSuites["{$suiteName}_{$splitCount}_G"] = $group;
491+
$this->addSuiteToConfig($suiteName, "{$suiteName}_{$splitCount}_G", $group);
492492

493493
$availableTests = array_diff_key($availableTests, $group);
494494
$splitCount++;

0 commit comments

Comments
 (0)