mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 16:54:08 +01:00
Merge pull request #157 from KennedyTedesco/builder-master
Added host() and port() to Builder
This commit is contained in:
commit
721198f212
@ -43,6 +43,28 @@ class Builder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define server host
|
||||
* @param int $host
|
||||
* @return $this
|
||||
*/
|
||||
public function host($host)
|
||||
{
|
||||
$this->config->setHost($host);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define server port
|
||||
* @param int $port
|
||||
* @return $this
|
||||
*/
|
||||
public function port($port)
|
||||
{
|
||||
$this->config->setPort($port);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you use an ssh config file you can user it.
|
||||
* @param string $file Config file path
|
||||
|
@ -31,7 +31,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
* @param int $port
|
||||
* @return Builder
|
||||
*/
|
||||
function server($name, $domain, $port = 22)
|
||||
function server($name, $domain = null, $port = 22)
|
||||
{
|
||||
$deployer = Deployer::get();
|
||||
|
||||
|
@ -30,6 +30,24 @@ class BuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$b->user('user', 'password');
|
||||
}
|
||||
|
||||
public function testHostAndPort()
|
||||
{
|
||||
$config = $this->getMockBuilder('Deployer\Server\Configuration')->disableOriginalConstructor()->getMock();
|
||||
$config->expects($this->once())
|
||||
->method('setHost')
|
||||
->with('localhost')
|
||||
->will($this->returnSelf());
|
||||
$config->expects($this->once())
|
||||
->method('setPort')
|
||||
->with(22)
|
||||
->will($this->returnSelf());
|
||||
$env = $this->getMock('Deployer\Server\Environment');
|
||||
|
||||
$b = new Builder($config, $env);
|
||||
$b->host('localhost');
|
||||
$b->port(22);
|
||||
}
|
||||
|
||||
public function testConfig()
|
||||
{
|
||||
$config = $this->getMockBuilder('Deployer\Server\Configuration')->disableOriginalConstructor()->getMock();
|
||||
|
Loading…
x
Reference in New Issue
Block a user