public function test_it_will_install_code_sniffer_with_specified_version() { $this->packageMock->expects(static::any())->method('hasPackage')->with(CodeSnifferCommand::PACKAGE_NAME, null, $this->inputMock, $this->outputMock)->willReturn(false); $this->questionMock->shouldReceive('ask')->once()->with($this->inputMock, $this->outputMock, Mockery::on(function (Question $question) { if (strpos($question->getQuestion(), 'What package version of CodeSniffer do you want to install? [latest]: ') !== false) { return true; } return false; }))->andReturn($version = 'v1.0'); $this->requireMock->expects(static::once())->method('requirePackage')->with($this->outputMock, CodeSnifferCommand::PACKAGE_NAME, $version, true)->willReturn(0); static::assertEquals(0, $this->sut->run($this->inputMock, $this->outputMock)); }
public function test_it_will_not_try_to_initialize_behat_if_installation_fails() { $this->packageMock->expects(static::any())->method('hasPackage')->with('behat/behat', null, $this->inputMock, $this->outputMock)->willReturn(false); $this->requireMock->expects(static::any())->method('requirePackage')->willReturn($status = 7); $this->processMock->expects(static::never())->method('mustRun'); static::assertEquals($status, $this->sut->run($this->inputMock, $this->outputMock)); }
public function test_it_will_not_install_phpunit_if_already_present() { $this->packageMock->expects(static::any())->method('hasPackage')->with('phpunit/phpunit', null, $this->inputMock, $this->outputMock)->willReturn(true); $this->requireMock->expects(static::never())->method('requirePackage'); static::assertEquals(0, $this->sut->run($this->inputMock, $this->outputMock)); }