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") ],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
}
|