Skip to content

Commit 2067b29

Browse files
authored
feature #1601 [tests] allow dev's to view test process output locally
1 parent 4735ff1 commit 2067b29

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<env name="MAKER_SKIP_PANTHER_TEST" value="false" />
2222
<!-- Overrides process timeout when step debugging -->
2323
<!-- <env name="MAKER_PROCESS_TIMEOUT" value="null" /> -->
24+
<!-- Dump the CLI output for a test runner process immediately after running a test -->
25+
<!-- You should only set this to true when you need to debug the actual output of a maker command within a test -->
26+
<!-- <env name="MAKER_TEST_DUMP_OUTPUT" value="false" /> -->
2427
</php>
2528

2629
<testsuites>

src/Test/MakerTestRunner.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ public function runMaker(array $inputs, string $argumentsString = '', bool $allo
3535
{
3636
$this->executedMakerProcess = $this->environment->runMaker($inputs, $argumentsString, $allowedToFail, $envVars);
3737

38-
return $this->executedMakerProcess->getOutput();
38+
$output = $this->executedMakerProcess->getOutput();
39+
40+
// Allows for debugging the actual CLI output from within a test process. E.g. Manually viewing the output of the
41+
// `make:voter` command that was run within the MakeVoterTest from your local command line.
42+
// You should never use this in CI unless you know what you're doing - resource intensive.
43+
if ('true' === getenv('MAKER_TEST_DUMP_OUTPUT')) {
44+
dump(['Maker Process Output' => $output, 'Maker Process Error Output' => $this->executedMakerProcess->getErrorOutput()]);
45+
}
46+
47+
return $output;
3948
}
4049

4150
/**

0 commit comments

Comments
 (0)