Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ protected function run(): void
case 'create-state':
$this->writeOutputStateToFile($config->getArrayValue(['parameters', 'arbitrary']));
break;
case 'create-result':
file_put_contents(
$this->getDataDir() . '/out/result.json',
(string) json_encode($config->getResult()),
);
break;
case 'whoami':
$process = new Process(['whoami']);
$process->mustRun();
Expand Down
5 changes: 5 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ public function getLogs(): array
// @phpstan-ignore-next-line because getArrayValue returns generic array
return $this->getArrayValue(['parameters', 'logs']);
}

public function getResult(): mixed
{
return $this->getValue(['parameters', 'result']);
}
}
2 changes: 2 additions & 0 deletions src/ConfigDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ protected function getParametersDefinition(): ArrayNodeDefinition
{
$operations = [
'application-error',
'create-result',
'create-state',
'child-jobs',
'dump-config',
Expand All @@ -38,6 +39,7 @@ protected function getParametersDefinition(): ArrayNodeDefinition
->end()
->scalarNode('timeout')->end()
->variableNode('arbitrary')->end()
->variableNode('result')->end()
->scalarNode('#token')->end()
->scalarNode('queueApiUrl')->end()
->scalarNode('childJobsCount')->end()
Expand Down
1 change: 1 addition & 0 deletions tests/functional/create-result/expected-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"variables":{"foo":"bar"}}
Empty file.
10 changes: 10 additions & 0 deletions tests/functional/create-result/source/data/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parameters": {
"operation": "create-result",
"result": {
"variables": {
"foo": "bar"
}
}
}
}
Loading