Пример #1
0
 public function testByStageName()
 {
     $servers = new ServerCollection();
     $servers['one'] = new \stdClass();
     $environments = new EnvironmentCollection();
     $environments['one'] = $env = new Environment();
     $env->set('stages', ['prod']);
     $stage = new StageStrategy($servers, $environments);
     $this->assertEquals(['one' => $servers['one']], $stage->getServers('prod'));
 }
Пример #2
0
/**
 * Return current server env or set default values or get env value.
 * When set env value you can write over values line "{{name}}".
 *
 * @param string|null $name
 * @param mixed $value
 * @return Environment|mixed
 */
function env($name = null, $value = null)
{
    if (false === Context::get()) {
        Environment::setDefault($name, $value);
    } else {
        if (null === $name && null === $value) {
            return Context::get()->getEnvironment();
        } elseif (null !== $name && null === $value) {
            return Context::get()->getEnvironment()->get($name);
        } else {
            Context::get()->getEnvironment()->set($name, $value);
        }
        return null;
    }
}
Пример #3
0
 /**
  * Indicate stage
  *
  * @param string|array $stages  Name or array on server stages.
  *
  * @return Builder
  */
 public function stage($stages)
 {
     $this->env->set('stages', (array) $stages);
     return $this;
 }
Пример #4
0
 public function testDownloadDirectory()
 {
     $this->_server->expects($this->once())->method('download')->with($this->_env->get("local_path"), $this->_env->get("remote_path"));
     download('{{local_path}}', '{{remote_path}}');
 }