/** * Tests the org:site:remove command */ public function testRemove() { $org_name = 'Organization Name'; $site_name = 'Site Name'; $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock(); $this->org_site_membership->expects($this->once())->method('delete')->with()->willReturn($this->workflow); $this->workflow->expects($this->once())->method('checkProgress')->willReturn(true); $this->site->expects($this->once())->method('get')->with($this->equalTo('name'))->willReturn($site_name); $this->organization->expects($this->once())->method('get')->with($this->equalTo('profile'))->willReturn((object) ['name' => $org_name]); $this->logger->expects($this->once())->method('log')->with($this->equalTo('notice'), $this->equalTo('{site} has been removed from the {org} organization.'), $this->equalTo(['site' => $site_name, 'org' => $org_name])); $out = $this->command->remove($this->organization->id, $this->site->id); $this->assertNull($out); }
/** * @inheritdoc */ public function setUp() { parent::setUp(); $this->workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock(); // workflow succeeded $this->workflow->expects($this->once())->method('checkProgress')->with()->willReturn(true); $this->workflow->expects($this->once())->method('getMessage')->with()->willReturn('successful workflow'); $this->environment->expects($this->once())->method('setHttpsCertificate')->with(['cert' => '*CERT*', 'key' => '*KEY*', 'intermediary' => '*INT*'])->willReturn($this->workflow); // should display a notice about the mode switch $this->logger->expects($this->at(0))->method('log')->with($this->equalTo('notice'), $this->equalTo('SSL certificate updated. Converging loadbalancer.')); $this->logger->expects($this->at(1))->method('log')->with($this->equalTo('notice'), $this->equalTo('successful workflow')); $this->command = new SetCommand(); $this->command->setSites($this->sites); $this->command->setLogger($this->logger); }