Skip to content

Commit

Permalink
Remove unneccessary cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinHassan committed May 25, 2024
1 parent 397bcbe commit ad3b81f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 50 deletions.
2 changes: 0 additions & 2 deletions src/Exercise/ASafeSpaceForNulls.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use PhpParser\NodeFinder;
use PhpParser\Parser;
use PhpSchool\PhpWorkshop\Check\FileComparisonCheck;
use PhpSchool\PhpWorkshop\Environment\CliTestEnvironment;
use PhpSchool\PhpWorkshop\Exercise\AbstractExercise;
use PhpSchool\PhpWorkshop\Exercise\CliExercise;
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
Expand All @@ -26,7 +25,6 @@
use PhpSchool\PhpWorkshop\Exercise\SubmissionPatchable;
use PhpSchool\PhpWorkshop\ExerciseCheck\FileComparisonExerciseCheck;
use PhpSchool\PhpWorkshop\ExerciseCheck\SelfCheck;
use PhpSchool\PhpWorkshop\ExerciseDispatcher;
use PhpSchool\PhpWorkshop\ExerciseRunner\Context\ExecutionContext;
use PhpSchool\PhpWorkshop\Patch;
use PhpSchool\PhpWorkshop\Result\Failure;
Expand Down
38 changes: 17 additions & 21 deletions test/Exercise/ASafeSpaceForNullsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public function getApplication(): Application
return require __DIR__ . '/../../app/bootstrap.php';
}

public function tearDown(): void
{
$this->removeSolutionAsset('users.csv');
}

public function testFailureWhenAgeAccessedWithoutNullSafe(): void
{
$this->runExercise('no-null-safe-age.php');
Expand Down Expand Up @@ -73,6 +68,23 @@ public function testFailureWhenAddressLine1AccessedWithoutNullSafe(): void
);
}


public function testFailureWhenCsvNotCorrect(): void
{
$this->runExercise('csv-wrong.php');

$this->assertVerifyWasNotSuccessful();

$this->assertResultsHasFailureAndMatches(
FileComparisonFailure::class,
function (FileComparisonFailure $failure) {
self::assertEquals('users.csv', $failure->getFileName());

return true;
}
);
}

public function testFailureWhenAddressLine2AccessedWithoutNullSafe(): void
{
$this->runExercise('no-null-safe-address-line2.php');
Expand All @@ -97,22 +109,6 @@ public function testFailureWhenCsvNotExported(): void
);
}

public function testFailureWhenCsvNotCorrect(): void
{
$this->runExercise('csv-wrong.php');

$this->assertVerifyWasNotSuccessful();

$this->assertResultsHasFailureAndMatches(
FileComparisonFailure::class,
function (FileComparisonFailure $failure) {
self::assertEquals('users.csv', $failure->getFileName());

return true;
}
);
}

public function testWithCorrectSolution(): void
{
$this->runExercise('correct-solution.php');
Expand Down
6 changes: 0 additions & 6 deletions test/Exercise/AllMixedUpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public function getApplication(): Application
return require __DIR__ . '/../../app/bootstrap.php';
}

public function tearDown(): void
{
$this->removeSolutionAsset('param.log');
parent::tearDown();
}

public function testSuccessfulSolution(): void
{
$this->runExercise('solution-correct.php');
Expand Down
6 changes: 3 additions & 3 deletions test/Exercise/LordOfTheStringsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testWithNoComposerFile(): void

public function testWithNoCode(): void
{
$this->runExercise('no-code/solution.php');
$this->runExercise('no-code/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -45,7 +45,7 @@ public function testWithNoCode(): void

public function testUsingBannedFunction(): void
{
$this->runExercise('banned-functions/solution.php');
$this->runExercise('banned-functions/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand Down Expand Up @@ -73,7 +73,7 @@ function (FunctionRequirementsFailure $failure) {

public function testWithCorrectSolution(): void
{
$this->runExercise('correct-solution/solution.php');
$this->runExercise('correct-solution/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasSuccessful();
}
Expand Down
36 changes: 18 additions & 18 deletions test/Exercise/TheAttributesOfSuccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ public function getApplication(): Application

public function testSuccessfulSolution(): void
{
$this->runExercise('correct-solution/solution.php');
$this->runExercise('correct-solution/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasSuccessful();
$this->assertOutputWasCorrect();
}

public function testSuccessfulSolutionWithPromotedProperty(): void
{
$this->runExercise('correct-solution-promoted/solution.php');
$this->runExercise('correct-solution-promoted/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasSuccessful();
$this->assertOutputWasCorrect();
}

public function testModifyingExternalCodeFails(): void
{
$this->runExercise('modified-external-code/solution.php');
$this->runExercise('modified-external-code/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();
$this->assertOutputWasCorrect();
Expand All @@ -57,7 +57,7 @@ function (FileComparisonFailure $failure) {

public function testNotCallingDeserializeFails(): void
{
$this->runExercise('no-deserialize-call/solution.php');
$this->runExercise('no-deserialize-call/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();
$this->assertOutputWasIncorrect();
Expand All @@ -73,7 +73,7 @@ function (FunctionRequirementsFailure $failure) {

public function testNotDumpingObjectFails(): void
{
$this->runExercise('no-var-dump/solution.php');
$this->runExercise('no-var-dump/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();
$this->assertOutputWasIncorrect();
Expand All @@ -89,7 +89,7 @@ function (FunctionRequirementsFailure $failure) {

public function testWhenOutputIsIncorrectComparisonFails(): void
{
$this->runExercise('incorrect-output/solution.php');
$this->runExercise('incorrect-output/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();
$this->assertOutputWasIncorrect();
Expand All @@ -102,7 +102,7 @@ public function testWhenOutputIsIncorrectComparisonFails(): void

public function testWhenNoClassNamedReviewDefined(): void
{
$this->runExercise('no-review-class/solution.php');
$this->runExercise('no-review-class/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -111,7 +111,7 @@ public function testWhenNoClassNamedReviewDefined(): void

public function testWhenNoMethodNamedObfuscateReviewerDefined(): void
{
$this->runExercise('no-obfuscate-method/solution.php');
$this->runExercise('no-obfuscate-method/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -120,7 +120,7 @@ public function testWhenNoMethodNamedObfuscateReviewerDefined(): void

public function testWhenNoAttributeDefinedOnObfuscateReviewerMethod(): void
{
$this->runExercise('no-attributes/solution.php');
$this->runExercise('no-attributes/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -129,7 +129,7 @@ public function testWhenNoAttributeDefinedOnObfuscateReviewerMethod(): void

public function testWhenNoAttributedNamedObfuscateUsedOnMethod(): void
{
$this->runExercise('no-attribute-named-obfuscate/solution.php');
$this->runExercise('no-attribute-named-obfuscate/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -141,7 +141,7 @@ public function testWhenNoAttributedNamedObfuscateUsedOnMethod(): void

public function testWhenNoArgumentsPassedToObfuscateAttribute(): void
{
$this->runExercise('no-arguments-obfuscate-attribute/solution.php');
$this->runExercise('no-arguments-obfuscate-attribute/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -153,7 +153,7 @@ public function testWhenNoArgumentsPassedToObfuscateAttribute(): void

public function testWhenIncorrectPropertyPassedToObfuscateAttribute(): void
{
$this->runExercise('invalid-arg-obfuscate-attribute/solution.php');
$this->runExercise('invalid-arg-obfuscate-attribute/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -165,7 +165,7 @@ public function testWhenIncorrectPropertyPassedToObfuscateAttribute(): void

public function testWhenObfuscateAttributeNotDefined(): void
{
$this->runExercise('no-obfuscate-class/solution.php');
$this->runExercise('no-obfuscate-class/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -174,7 +174,7 @@ public function testWhenObfuscateAttributeNotDefined(): void

public function testWhenObfuscateHasNoAttributes(): void
{
$this->runExercise('obfuscate-no-attributes/solution.php');
$this->runExercise('obfuscate-no-attributes/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -183,7 +183,7 @@ public function testWhenObfuscateHasNoAttributes(): void

public function testWhenObfuscateAttributeIncorrectlyDefined(): void
{
$this->runExercise('obfuscate-attribute-incorrect/solution.php');
$this->runExercise('obfuscate-attribute-incorrect/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -192,7 +192,7 @@ public function testWhenObfuscateAttributeIncorrectlyDefined(): void

public function testWhenObfuscateAttributeHasNoFlags(): void
{
$this->runExercise('obfuscate-attribute-no-flags/solution.php');
$this->runExercise('obfuscate-attribute-no-flags/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -201,7 +201,7 @@ public function testWhenObfuscateAttributeHasNoFlags(): void

public function testWhenObfuscateAttributeConfigurationIsWrong(): void
{
$this->runExercise('obfuscate-attribute-wrong-target/solution.php');
$this->runExercise('obfuscate-attribute-wrong-target/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand All @@ -213,7 +213,7 @@ public function testWhenObfuscateAttributeConfigurationIsWrong(): void

public function testWhenObfuscateAttributeHasNoPublicPropertyNamedKey(): void
{
$this->runExercise('no-public-property-named-key/solution.php');
$this->runExercise('no-public-property-named-key/solution.php', self::DIRECTORY_SOLUTION);

$this->assertVerifyWasNotSuccessful();

Expand Down

0 comments on commit ad3b81f

Please sign in to comment.