From 1dc4d4a1c7e14c4ec0686a9ea52238e696cbcfe2 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Sat, 25 May 2024 15:46:58 +0200 Subject: [PATCH] Remove unneccessary cleanup --- composer.lock | 8 ++--- src/Exercise/ASafeSpaceForNulls.php | 2 -- test/Exercise/ASafeSpaceForNullsTest.php | 38 +++++++++----------- test/Exercise/AllMixedUpTest.php | 6 ---- test/Exercise/LordOfTheStringsTest.php | 6 ++-- test/Exercise/TheAttributesOfSuccessTest.php | 36 +++++++++---------- 6 files changed, 42 insertions(+), 54 deletions(-) diff --git a/composer.lock b/composer.lock index 7dcc4b9..23a2645 100644 --- a/composer.lock +++ b/composer.lock @@ -1130,12 +1130,12 @@ "source": { "type": "git", "url": "https://github.com/php-school/php-workshop.git", - "reference": "86979bef6c82f5b835dc8a2906417a8c9d66b7c3" + "reference": "0790024a850786bfcbcefe7873da37bcc7b8e22d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-school/php-workshop/zipball/86979bef6c82f5b835dc8a2906417a8c9d66b7c3", - "reference": "86979bef6c82f5b835dc8a2906417a8c9d66b7c3", + "url": "https://api.github.com/repos/php-school/php-workshop/zipball/0790024a850786bfcbcefe7873da37bcc7b8e22d", + "reference": "0790024a850786bfcbcefe7873da37bcc7b8e22d", "shasum": "" }, "require": { @@ -1211,7 +1211,7 @@ "issues": "https://github.com/php-school/php-workshop/issues", "source": "https://github.com/php-school/php-workshop/tree/docker-fixes" }, - "time": "2024-05-25T12:02:59+00:00" + "time": "2024-05-25T13:44:46+00:00" }, { "name": "php-school/terminal", diff --git a/src/Exercise/ASafeSpaceForNulls.php b/src/Exercise/ASafeSpaceForNulls.php index d8887a8..117a66a 100644 --- a/src/Exercise/ASafeSpaceForNulls.php +++ b/src/Exercise/ASafeSpaceForNulls.php @@ -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; @@ -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; diff --git a/test/Exercise/ASafeSpaceForNullsTest.php b/test/Exercise/ASafeSpaceForNullsTest.php index 5a8aa4e..98023c5 100644 --- a/test/Exercise/ASafeSpaceForNullsTest.php +++ b/test/Exercise/ASafeSpaceForNullsTest.php @@ -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'); @@ -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'); @@ -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'); diff --git a/test/Exercise/AllMixedUpTest.php b/test/Exercise/AllMixedUpTest.php index bc5f34c..8d8bad8 100644 --- a/test/Exercise/AllMixedUpTest.php +++ b/test/Exercise/AllMixedUpTest.php @@ -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'); diff --git a/test/Exercise/LordOfTheStringsTest.php b/test/Exercise/LordOfTheStringsTest.php index 2cc9f62..60ce21e 100644 --- a/test/Exercise/LordOfTheStringsTest.php +++ b/test/Exercise/LordOfTheStringsTest.php @@ -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(); @@ -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(); @@ -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(); } diff --git a/test/Exercise/TheAttributesOfSuccessTest.php b/test/Exercise/TheAttributesOfSuccessTest.php index 7e480d7..6c1e42a 100644 --- a/test/Exercise/TheAttributesOfSuccessTest.php +++ b/test/Exercise/TheAttributesOfSuccessTest.php @@ -24,7 +24,7 @@ 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(); @@ -32,7 +32,7 @@ public function testSuccessfulSolution(): void 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(); @@ -40,7 +40,7 @@ public function testSuccessfulSolutionWithPromotedProperty(): void 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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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(); @@ -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();