Inheritance: extends TerminusCollection, implements Pantheon\Terminus\Session\SessionAwareInterface, use trait Pantheon\Terminus\Session\SessionAwareTrait
Exemplo n.º 1
0
 /**
  * Tests Branch::delete()
  */
 public function testDelete()
 {
     $this->site->id = 'site_id';
     $this->workflows->expects($this->once())->method('create')->with($this->equalTo('delete_environment_branch'), $this->equalTo(['params' => ['environment_id' => $this->model->id]]))->willReturn($this->workflow);
     $workflow = $this->model->delete();
     $this->assertEquals($workflow, $this->workflow);
 }
Exemplo n.º 2
0
 /**
  * Tests NewRelic::enable()
  */
 public function testEnable()
 {
     $this->site->id = 'site_id';
     $this->workflows->expects($this->once())->method('create')->with($this->equalTo('enable_new_relic_for_site'), $this->equalTo(['site' => $this->site->id]))->willReturn($this->workflow);
     $workflow = $this->model->enable();
     $this->assertEquals($workflow, $this->workflow);
 }
Exemplo n.º 3
0
 /**
  * Tests Site::updateServiceLevel($service_level)
  */
 public function testUpdateServiceLevel()
 {
     $service_level = 'service_level';
     $this->workflows->expects($this->once())->method('create')->with($this->equalTo('change_site_service_level'), $this->equalTo(['params' => compact('service_level')]))->willReturn($this->workflow);
     $workflow = $this->model->updateServiceLevel($service_level);
     $this->assertEquals($workflow, $this->workflow);
 }
Exemplo n.º 4
0
 public function testDeleteWithBranch()
 {
     $model = $this->_createModel(['id' => 'mymulti2']);
     $this->site->method('getWorkflows')->willReturn($this->workflows);
     $this->workflows->expects($this->any())->method('create')->with('delete_cloud_development_environment', ['params' => ['environment_id' => 'mymulti2', 'delete_branch' => true]])->willReturn($this->workflow);
     $actual = $model->delete(['delete_branch' => true]);
     $this->assertEquals($this->workflow, $actual);
 }
Exemplo n.º 5
0
 public function testGetOwnerObject()
 {
     $site = new Site((object) ['id' => 'site_id']);
     $environments = new Environments(['site' => $site]);
     $env = new Environment((object) ['id' => 'env_id'], ['collection' => $environments]);
     $user = new User((object) ['id' => 'user_id']);
     $org = new Organization((object) ['id' => 'org_id']);
     $workflows = new Workflows(['environment' => $env]);
     $this->assertEquals($env, $workflows->getOwnerObject());
     $this->assertEquals('sites/site_id/environments/env_id/workflows', $workflows->getUrl());
     $workflows = new Workflows(['site' => $site]);
     $this->assertEquals($site, $workflows->getOwnerObject());
     $this->assertEquals('sites/site_id/workflows', $workflows->getUrl());
     $workflows = new Workflows(['user' => $user]);
     $this->assertEquals($user, $workflows->getOwnerObject());
     $this->assertEquals('users/user_id/workflows', $workflows->getUrl());
     $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock();
     $session->expects($this->once())->method('getUser')->willReturn($user);
     $workflows = new Workflows(['organization' => $org]);
     $workflows->setSession($session);
     $this->assertEquals($org, $workflows->getOwnerObject());
     $this->assertEquals('users/user_id/organizations/org_id/workflows', $workflows->getUrl());
 }