Pantheon\Terminus\UnitTests\Commands\Site\CreateCommandTest::testCreate PHP Method

testCreate() public method

Exercises the site:create command
public testCreate ( )
    public function testCreate()
    {
        $site_name = 'site_name';
        $label = 'label';
        $workflow = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
        $workflow2 = $this->getMockBuilder(Workflow::class)->disableOriginalConstructor()->getMock();
        $this->sites->expects($this->once())->method('create')->with($this->equalTo(['site_name' => $site_name, 'label' => $label]))->willReturn($workflow);
        $workflow->expects($this->once())->method('checkProgress')->with()->willReturn(true);
        $this->logger->expects($this->at(0))->method('log')->with($this->equalTo('notice'), $this->equalTo('Creating a new site...'));
        $this->logger->expects($this->at(1))->method('log')->with($this->equalTo('notice'), $this->equalTo('Deploying CMS...'));
        $this->site->expects($this->once())->method('deployProduct')->with($this->equalTo($this->upstream->id))->willReturn($workflow2);
        $workflow2->expects($this->once())->method('checkProgress')->with()->willReturn(true);
        $this->logger->expects($this->at(2))->method('log')->with($this->equalTo('notice'), $this->equalTo('Deployed CMS'));
        $out = $this->command->create($site_name, $label, 'upstream');
        $this->assertNull($out);
    }
CreateCommandTest