Christopher Vagnetoft
8cc1eac7a4
* 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
31 lines
692 B
PHP
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") ],
|
|
];
|
|
}
|
|
|
|
}
|