From 207de4ef6c8d1aa8e7a0c95a87c27213ca8c3bef Mon Sep 17 00:00:00 2001 From: Jakob Vibe Date: Thu, 5 Oct 2023 19:03:58 +0200 Subject: [PATCH] PhpStan fixes --- tests/Composer/Test/Command/InitCommandTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Composer/Test/Command/InitCommandTest.php b/tests/Composer/Test/Command/InitCommandTest.php index 9965dc9a5..140ddd024 100644 --- a/tests/Composer/Test/Command/InitCommandTest.php +++ b/tests/Composer/Test/Command/InitCommandTest.php @@ -139,7 +139,6 @@ class InitCommandTest extends TestCase { $command = new DummyInitCommand; $gitConfig = $command->getGitConfig(); - $this->assertIsArray($gitConfig); $this->assertArrayHasKey('user.name', $gitConfig); $this->assertArrayHasKey('user.email', $gitConfig); $this->assertArrayHasKey('remote.origin.url', $gitConfig); @@ -148,16 +147,19 @@ class InitCommandTest extends TestCase public function testAddVendorIgnore(): void { $command = new DummyInitCommand; - $ignoreFile = $this->getUniqueTmpDirectory().'/ignore'; + $ignoreFile = self::getUniqueTmpDirectory().'/ignore'; $command->addVendorIgnore($ignoreFile); $this->assertFileExists($ignoreFile); - $this->assertStringContainsString('/vendor/', file_get_contents($ignoreFile)); + if (file_exists($ignoreFile)) { + $content = (string) file_get_contents($ignoreFile); + $this->assertStringContainsString('/vendor/', $content); + } } public function testHasVendorIgnore(): void { $command = new DummyInitCommand; - $ignoreFile = $this->getUniqueTmpDirectory().'/ignore'; + $ignoreFile = self::getUniqueTmpDirectory().'/ignore'; $this->assertFalse($command->hasVendorIgnore($ignoreFile)); $command->addVendorIgnore($ignoreFile); $this->assertTrue($command->hasVendorIgnore($ignoreFile));