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
This commit is contained in:
		
							
								
								
									
										30
									
								
								tests/Environment/ScriptRunnerTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								tests/Environment/ScriptRunnerTest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
<?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") ],
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user