Skip to content

Commit

Permalink
Utilises symfony/console constants
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelstolt committed Jul 23, 2024
1 parent 286a138 commit 1111202
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
11 changes: 6 additions & 5 deletions tests/Commands/InitCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Stolt\LeanPackage\Tests\CommandTester;
use Stolt\LeanPackage\Tests\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;

class InitCommandTest extends TestCase
Expand Down Expand Up @@ -129,7 +130,7 @@ public function failingInitReturnsExpectedStatusCode(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() !== 0);
$this->assertTrue($commandTester->getStatusCode() !== Command::SUCCESS);

$mock->disable();
}
Expand All @@ -155,7 +156,7 @@ public function existingDefaultLpvFileIsNotOverwritten(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() !== 0);
$this->assertTrue($commandTester->getStatusCode() !== Command::SUCCESS);
}

#[Test]
Expand All @@ -175,7 +176,7 @@ public function usingANonAvailablePresetShowsWarning(): void
);

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() !== 0);
$this->assertTrue($commandTester->getStatusCode() !== Command::SUCCESS);
}

#[Test]
Expand All @@ -202,7 +203,7 @@ public function verboseOutputIsAvailableWhenDesired(): void
);

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() !== 0);
$this->assertTrue($commandTester->getStatusCode() !== Command::SUCCESS);
}

#[Test]
Expand All @@ -218,7 +219,7 @@ public function existingDefaultLpvFileIsOverwrittenWhenDesired(): void
$commandTester->execute([
'command' => $command->getName(),
'directory' => WORKING_DIRECTORY,
'-o' => true,
'--overwrite' => true,
]);

$expectedDisplay = <<<CONTENT
Expand Down
53 changes: 27 additions & 26 deletions tests/Commands/ValidateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Stolt\LeanPackage\Tests\CommandTester;
use Stolt\LeanPackage\Tests\TestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Zenstruck\Console\Test\InteractsWithConsole;
use Zenstruck\Console\Test\TestCommand;

Expand Down Expand Up @@ -99,7 +100,7 @@ public function validateOnNonExistentGitattributesFilesSuggestsCreation(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -143,7 +144,7 @@ public function validateOnNonExistentGitattributesFilesSuggestsCreationWithAlign
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -184,7 +185,7 @@ public function showsDifferenceBetweenActualAndExpectedGitattributesContent(): v
$this->assertContains($expectedDiffRow, $actualDisplayRows);
}

$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -253,7 +254,7 @@ public function filesInGlobalGitignoreAreExportIgnored(): void
CONTENT;

$this->assertStringEqualsStringIgnoringLineEndings($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -330,7 +331,7 @@ public function gitattributesFileWithNoExportIgnoresContentShowsExpectedContent(
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -409,7 +410,7 @@ public function licenseIsInSuggestedFileContentPerDefault(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -451,7 +452,7 @@ public function licenseIsNotInSuggestedFileContent(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -495,7 +496,7 @@ public function licenseIsNotInSuggestedFileContentWithCustomGlobPattern(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -546,7 +547,7 @@ public function presentExportIgnoredLicenseWithKeepLicenseOptionInvalidatesResul
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -592,7 +593,7 @@ public function archiveWithoutLicenseFileIsConsideredInvalid(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -674,7 +675,7 @@ public function failingGitattributesFilesCreationReturnsExpectedStatusCode(): vo
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);

$mock->disable();
}
Expand Down Expand Up @@ -897,7 +898,7 @@ public function invalidGitattributesReturnsExpectedStatusCode(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -944,7 +945,7 @@ public function optionalGlobPatternIsApplied(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand All @@ -966,7 +967,7 @@ public function usageOfInvalidGlobFailsValidation(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand All @@ -989,7 +990,7 @@ public function missingGlobPatternProducesUserFriendlyErrorMessage(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1113,7 +1114,7 @@ public function nonLeanArchiveIsNotConsideredLeanPlural(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1159,7 +1160,7 @@ public function nonLeanArchiveIsNotConsideredLeanSingular(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1192,7 +1193,7 @@ public function impossibilityToResolveExpectedGitattributesFileContentIsInfoed()
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand All @@ -1215,7 +1216,7 @@ public function invalidDirectoryAgumentReturnsExpectedStatusCode(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1375,7 +1376,7 @@ public function staleExportIgnoresAreConsideredAsInvalid(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1473,7 +1474,7 @@ public function failingGitattributesFilesOverwriteReturnsExpectedStatusCode(): v
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);

$mock->disable();
}
Expand Down Expand Up @@ -1569,7 +1570,7 @@ public function strictAlignmentOfExportIgnoresCanBeEnforced(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1620,7 +1621,7 @@ public function strictAlignmentAndOrderOfExportIgnoresCanBeEnforced(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1672,7 +1673,7 @@ public function strictOrderOfExportIgnoresCanBeEnforced(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1872,7 +1873,7 @@ public function providedNonExistentGlobPatternFileFailsValidation(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down Expand Up @@ -1912,7 +1913,7 @@ public function providedInvalidGlobPatternFileFailsValidation(): void
CONTENT;

$this->assertSame($expectedDisplay, $commandTester->getDisplay());
$this->assertTrue($commandTester->getStatusCode() > 0);
$this->assertTrue($commandTester->getStatusCode() > Command::SUCCESS);
}

#[Test]
Expand Down

0 comments on commit 1111202

Please sign in to comment.