diff --git a/tests/Smoke/InstallViaComposerTest.php b/tests/Smoke/InstallViaComposerTest.php index 6b77557f3f2..4e52c40db1f 100644 --- a/tests/Smoke/InstallViaComposerTest.php +++ b/tests/Smoke/InstallViaComposerTest.php @@ -32,7 +32,7 @@ */ final class InstallViaComposerTest extends AbstractSmokeTestCase { - private Filesystem $fs; + private ?Filesystem $fs; /** @var array */ private array $currentCodeAsComposerDependency = [ @@ -64,13 +64,6 @@ final class InstallViaComposerTest extends AbstractSmokeTestCase 'vendor/bin/php-cs-fixer fix --help', ]; - public function __construct() - { - $this->fs = new Filesystem(); - - parent::__construct(); - } - public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -98,6 +91,16 @@ public static function setUpBeforeClass(): void } } + protected function setUp(): void + { + $this->fs = new Filesystem(); + } + + protected function tearDown(): void + { + $this->fs = null; + } + public function testInstallationViaPathIsPossible(): void { $tmpPath = $this->createFakeComposerProject($this->currentCodeAsComposerDependency); diff --git a/tests/TestCase.php b/tests/TestCase.php index d89ec8f526f..72da70e130a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -25,4 +25,14 @@ abstract class TestCase extends BaseTestCase { use ExpectDeprecationTrait; + + final public function testNotDefiningConstructor(): void + { + $reflection = new \ReflectionObject($this); + + self::assertNotSame( + $reflection->getConstructor()->getDeclaringClass()->getName(), + $reflection->getName(), + ); + } }