/** * @param string $path [Optional] Temporary path from which the Configuration framework * should load files. This is useful when writing temp files to disk for funtional tests */ public static function reset($path = null) { if (!self::$pathField) { self::$pathField = Reflection_Helper::get_property('Bart\\Configuration\\Configuration', 'path'); self::$configCacheField = Reflection_Helper::get_property('Bart\\Configuration\\Configuration', 'configCache'); } self::$pathField->setValue(null, $path); self::$configCacheField->setValue(null, []); }
public function test_chain_commands() { $this->registerMockShell(); $git = new Git('.git'); $hello_world_commands = array('hello world', 'and then there was more'); $method = Util\Reflection_Helper::get_method('Bart\\Git', 'chain_commands'); $hello = $method->invokeArgs($git, array($hello_world_commands)); $this->assertEquals($hello, 'git --git-dir=.git hello world && git --git-dir=.git and then there was more', 'Chain commands produced wrong cmd'); }
private static function getSafeCommandFrom(Command $c) { $field = \Bart\Util\Reflection_Helper::get_property('Bart\\Shell\\Command', 'safeCommandStr'); return $field->getValue($c); }
/** * @param array $configsArray The new internal configurations */ public function configureForTesting(array $configsArray) { $this->configurations = $configsArray; // Some rigmarole for any methods using updateRuntimeConfiguration $pathField = Reflection_Helper::get_property('Bart\\Configuration\\Configuration', 'filePath'); $pathField->setValue($this, ''); TestConfigurationsHelper::setConfigCache($configsArray); }