php-spark/tests/Environment/ScriptRunnerTest.php

31 lines
692 B
PHP
Raw Normal View History

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