Skip to content

Commit ad3b81f

Browse files
committed
Remove unneccessary cleanup
1 parent 397bcbe commit ad3b81f

File tree

5 files changed

+38
-50
lines changed

5 files changed

+38
-50
lines changed

src/Exercise/ASafeSpaceForNulls.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use PhpParser\NodeFinder;
1818
use PhpParser\Parser;
1919
use PhpSchool\PhpWorkshop\Check\FileComparisonCheck;
20-
use PhpSchool\PhpWorkshop\Environment\CliTestEnvironment;
2120
use PhpSchool\PhpWorkshop\Exercise\AbstractExercise;
2221
use PhpSchool\PhpWorkshop\Exercise\CliExercise;
2322
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
@@ -26,7 +25,6 @@
2625
use PhpSchool\PhpWorkshop\Exercise\SubmissionPatchable;
2726
use PhpSchool\PhpWorkshop\ExerciseCheck\FileComparisonExerciseCheck;
2827
use PhpSchool\PhpWorkshop\ExerciseCheck\SelfCheck;
29-
use PhpSchool\PhpWorkshop\ExerciseDispatcher;
3028
use PhpSchool\PhpWorkshop\ExerciseRunner\Context\ExecutionContext;
3129
use PhpSchool\PhpWorkshop\Patch;
3230
use PhpSchool\PhpWorkshop\Result\Failure;

test/Exercise/ASafeSpaceForNullsTest.php

+17-21
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ public function getApplication(): Application
2020
return require __DIR__ . '/../../app/bootstrap.php';
2121
}
2222

23-
public function tearDown(): void
24-
{
25-
$this->removeSolutionAsset('users.csv');
26-
}
27-
2823
public function testFailureWhenAgeAccessedWithoutNullSafe(): void
2924
{
3025
$this->runExercise('no-null-safe-age.php');
@@ -73,6 +68,23 @@ public function testFailureWhenAddressLine1AccessedWithoutNullSafe(): void
7368
);
7469
}
7570

71+
72+
public function testFailureWhenCsvNotCorrect(): void
73+
{
74+
$this->runExercise('csv-wrong.php');
75+
76+
$this->assertVerifyWasNotSuccessful();
77+
78+
$this->assertResultsHasFailureAndMatches(
79+
FileComparisonFailure::class,
80+
function (FileComparisonFailure $failure) {
81+
self::assertEquals('users.csv', $failure->getFileName());
82+
83+
return true;
84+
}
85+
);
86+
}
87+
7688
public function testFailureWhenAddressLine2AccessedWithoutNullSafe(): void
7789
{
7890
$this->runExercise('no-null-safe-address-line2.php');
@@ -97,22 +109,6 @@ public function testFailureWhenCsvNotExported(): void
97109
);
98110
}
99111

100-
public function testFailureWhenCsvNotCorrect(): void
101-
{
102-
$this->runExercise('csv-wrong.php');
103-
104-
$this->assertVerifyWasNotSuccessful();
105-
106-
$this->assertResultsHasFailureAndMatches(
107-
FileComparisonFailure::class,
108-
function (FileComparisonFailure $failure) {
109-
self::assertEquals('users.csv', $failure->getFileName());
110-
111-
return true;
112-
}
113-
);
114-
}
115-
116112
public function testWithCorrectSolution(): void
117113
{
118114
$this->runExercise('correct-solution.php');

test/Exercise/AllMixedUpTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ public function getApplication(): Application
2121
return require __DIR__ . '/../../app/bootstrap.php';
2222
}
2323

24-
public function tearDown(): void
25-
{
26-
$this->removeSolutionAsset('param.log');
27-
parent::tearDown();
28-
}
29-
3024
public function testSuccessfulSolution(): void
3125
{
3226
$this->runExercise('solution-correct.php');

test/Exercise/LordOfTheStringsTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testWithNoComposerFile(): void
3636

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

4141
$this->assertVerifyWasNotSuccessful();
4242

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

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

5050
$this->assertVerifyWasNotSuccessful();
5151

@@ -73,7 +73,7 @@ function (FunctionRequirementsFailure $failure) {
7373

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

7878
$this->assertVerifyWasSuccessful();
7979
}

test/Exercise/TheAttributesOfSuccessTest.php

+18-18
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ public function getApplication(): Application
2424

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

2929
$this->assertVerifyWasSuccessful();
3030
$this->assertOutputWasCorrect();
3131
}
3232

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

3737
$this->assertVerifyWasSuccessful();
3838
$this->assertOutputWasCorrect();
3939
}
4040

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

4545
$this->assertVerifyWasNotSuccessful();
4646
$this->assertOutputWasCorrect();
@@ -57,7 +57,7 @@ function (FileComparisonFailure $failure) {
5757

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

6262
$this->assertVerifyWasNotSuccessful();
6363
$this->assertOutputWasIncorrect();
@@ -73,7 +73,7 @@ function (FunctionRequirementsFailure $failure) {
7373

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

7878
$this->assertVerifyWasNotSuccessful();
7979
$this->assertOutputWasIncorrect();
@@ -89,7 +89,7 @@ function (FunctionRequirementsFailure $failure) {
8989

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

9494
$this->assertVerifyWasNotSuccessful();
9595
$this->assertOutputWasIncorrect();
@@ -102,7 +102,7 @@ public function testWhenOutputIsIncorrectComparisonFails(): void
102102

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

107107
$this->assertVerifyWasNotSuccessful();
108108

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

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

116116
$this->assertVerifyWasNotSuccessful();
117117

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

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

125125
$this->assertVerifyWasNotSuccessful();
126126

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

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

134134
$this->assertVerifyWasNotSuccessful();
135135

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

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

146146
$this->assertVerifyWasNotSuccessful();
147147

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

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

158158
$this->assertVerifyWasNotSuccessful();
159159

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

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

170170
$this->assertVerifyWasNotSuccessful();
171171

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

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

179179
$this->assertVerifyWasNotSuccessful();
180180

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

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

188188
$this->assertVerifyWasNotSuccessful();
189189

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

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

197197
$this->assertVerifyWasNotSuccessful();
198198

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

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

206206
$this->assertVerifyWasNotSuccessful();
207207

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

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

218218
$this->assertVerifyWasNotSuccessful();
219219

0 commit comments

Comments
 (0)