Skip to content

Commit 01703d4

Browse files
committed
wut
1 parent 18de201 commit 01703d4

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/ExerciseRunner/CgiRunner.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private function doVerify(ExecutionContext $context, CgiScenario $scenario, Requ
157157
$context,
158158
$scenario,
159159
$context->getStudentExecutionDirectory(),
160-
$context->getEntryPoint(),
160+
basename($context->getEntryPoint()),
161161
$event->getRequest(),
162162
'student',
163163
);
@@ -227,6 +227,7 @@ private function executePhpFile(
227227

228228
//if no status line, pre-pend 200 OK
229229
$output = $process->getOutput();
230+
$error = $process->getErrorOutput();
230231
if (!preg_match('/^HTTP\/([1-9]\d*\.\d) ([1-5]\d{2})(\s+(.+))?\\r\\n/', $output)) {
231232
$output = "HTTP/1.0 200 OK\r\n" . $output;
232233
}

src/ExerciseRunner/CliRunner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private function doVerify(ExecutionContext $context, CliScenario $scenario, Coll
160160
$context,
161161
$scenario,
162162
$context->getStudentExecutionDirectory(),
163-
$context->getEntryPoint(),
163+
basename($context->getEntryPoint()),
164164
$event->getArgs(),
165165
'student',
166166
);

src/Process/DockerProcessFactory.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ public function create(ProcessInput $processInput): Process
3434
$mounts[] = $this->composerCacheDir . ':/root/.composer/cache';
3535
}
3636

37-
$env = array_map(function ($key, $value) {
38-
return sprintf('-e %s=%s', $key, $value);
39-
}, array_keys($processInput->getEnv()), $processInput->getEnv());
37+
$env = [];
38+
foreach ($processInput->getEnv() as $key => $value) {
39+
$env[] = '-e';
40+
$env[] = $key . '=' . $value;
41+
}
4042

4143
return new Process(
4244
[

src/TestUtils/WorkshopExerciseTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function setUp(): void
5757

5858
public function tearDown(): void
5959
{
60-
(new Filesystem())->remove(System::tempDir());
60+
// (new Filesystem())->remove(System::tempDir());
6161
}
6262

6363
/**

test/Process/DockerProcessFactoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function testCreateWithEnv(): void
9393

9494
$process = $factory->create($input);
9595
$cmd = "'/usr/local/bin/docker' 'compose' '-p' 'php8appreciate' '-f' '.docker/runtime/docker-compose.yml'";
96-
$cmd .= " 'run' '--rm' '-e SOME_VAR=value' '-w' '/solution' 'runtime' 'php' 'one' 'two'";
96+
$cmd .= " 'run' '--rm' '-e' 'SOME_VAR=value' '-w' '/solution' 'runtime' 'php' 'one' 'two'";
9797
static::assertSame($cmd, $process->getCommandLine());
9898
static::assertSame('/docker-dir', $process->getWorkingDirectory());
9999
}
@@ -129,7 +129,7 @@ public function testSolutionDirectoryIsPassedAsEnvVar(): void
129129

130130
$process = $factory->create($input);
131131
$cmd = "'/usr/local/bin/docker' 'compose' '-p' 'php8appreciate' '-f' '.docker/runtime/docker-compose.yml'";
132-
$cmd .= " 'run' '--rm' '-e SOME_VAR=value' '-w' '/solution' 'runtime' 'php' 'one' 'two'";
132+
$cmd .= " 'run' '--rm' '-e' 'SOME_VAR=value' '-w' '/solution' 'runtime' 'php' 'one' 'two'";
133133
static::assertSame($cmd, $process->getCommandLine());
134134
static::assertSame('/docker-dir', $process->getWorkingDirectory());
135135
static::assertSame(['SOLUTION' => __DIR__], $process->getEnv());

0 commit comments

Comments
 (0)