Наследование: extends TerminusModel, implements Robo\Contract\ConfigAwareInterface, implements League\Container\ContainerAwareInterface, use trait Robo\Common\ConfigAwareTrait, use trait League\Container\ContainerAwareTrait
Пример #1
0
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
     $this->workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->getMock();
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->site->method('getWorkflows')->willReturn($this->workflows);
     $this->model = new NewRelic(null, ['site' => $this->site]);
     $this->model->setRequest($this->request);
     $this->model->setConfig($this->config);
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
     $this->workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->getMock();
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->site->method('getWorkflows')->willReturn($this->workflows);
     $this->collection = $this->getMockBuilder(Branches::class)->disableOriginalConstructor()->getMock();
     $this->collection->site = $this->site;
     $this->model = new Branch((object) ['id' => 'branch_id', 'sha' => 'sha'], ['collection' => $this->collection]);
     $this->model->setRequest($this->request);
 }
Пример #3
0
 /**
  * Gives Git connection info for this environment
  *
  * @return array
  */
 public function gitConnectionInfo()
 {
     $username = "******";
     $hostname = "codeserver.dev.{$this->site->id}.drush.in";
     $port = '2222';
     $url = "ssh://{$username}@{$hostname}:{$port}/~/repository.git";
     $command = "git clone {$url} {$this->site->get('name')}";
     $info = ['username' => $username, 'host' => $hostname, 'port' => $port, 'url' => $url, 'command' => $command];
     return $info;
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     if (!$this->config) {
         $this->config = new Config();
     }
     if (!$this->container) {
         $this->container = new Container();
     }
     // These are not used by every test but are useful for SiteAwareInterface commands. Which is a lot of them.
     // Use `$command->setSites($this->site());` after you create your command to test.
     $this->site = $this->getMockBuilder(Site::class)->disableOriginalConstructor()->getMock();
     $this->environment = $this->getMockBuilder(Environment::class)->disableOriginalConstructor()->getMock();
     $this->environments = $this->getMockBuilder(Environments::class)->disableOriginalConstructor()->getMock();
     $this->environments->method('get')->willReturn($this->environment);
     $this->site->method('getEnvironments')->willReturn($this->environments);
     $this->sites = $this->getMockBuilder(Sites::class)->disableOriginalConstructor()->getMock();
     $this->sites->method('get')->willReturn($this->site);
     // A lot of commands output to a logger.
     // To use this call `$command->setLogger($this->logger);` after you create your command to test.
     $this->logger = $this->getMockBuilder(NullLogger::class)->setMethods(array('log'))->getMock();
 }
 /**
  * Changes the role of the given member
  *
  * @param string $role Desired role for this organization
  * @return Workflow
  */
 public function setRole($role)
 {
     $workflow = $this->site->getWorkflows()->create('update_site_organization_membership', ['params' => ['organization_id' => $this->id, 'role' => $role]]);
     return $workflow;
 }
Пример #6
0
 /**
  * Enables New Relic
  *
  * @return Workflow
  */
 public function enable()
 {
     return $this->site->getWorkflows()->create('enable_new_relic_for_site', ['site' => $this->site->id]);
 }