php-spark/tests/Environment/ScriptRunnerTest.php
Christopher Vagnetoft 8cc1eac7a4 Multiple fixes
* Implemented ScriptRunner with environment expansion and cleaner
  code.
* Added ApiClient plugin (com.noccy.apiclient)
* Renamed CHANGELOG.md to VERSIONS.md
* Shuffled buildtools
* Added first unittests
2021-12-11 01:44:01 +01:00

31 lines
692 B
PHP

<?php
namespace Spark\Environment;
class ScriptRunnerTest extends \PhpUnit\Framework\TestCase
{
/**
* @dataProvider stringExpansionData
* @covers ScriptRunner::expandString
*/
public function testStringExpansion($source, $expect)
{
$runner = new ScriptRunner();
$expanded = $runner->expandString($source);
return $this->assertEquals($expect, $expanded);
}
public function stringExpansionData()
{
return [
[ 'Hello World!', 'Hello World!' ],
[ '${testenv}', '' ],
[ '${PATH}', getenv("PATH") ],
[ 'Greetings ${USER}', 'Greetings '.getenv("USER") ],
];
}
}