public function testApacheWillEnableNewVhost() { $cli = $this->getMockBuilder('TestSystem')->setMethods(['dir', 'restart', 'a2ensite'])->disableOriginalConstructor()->getMock(); $cli->expects($this->once())->method('a2ensite'); $cli->expects($this->any())->method('dir')->willReturn(__DIR__ . static::APACHE_VHOST_DIR); $apache = new Apache($cli); $apache->add($this->virtualhost); }
#!/usr/bin/php <?php require_once __DIR__ . '/../bootstrap.php'; use Vhost\Server\Apache; use Vhost\Virtualhost; use Vhost\System; $system = new System(); $apache = new Apache($system); $site = $argv[1]; $virtualhost = new Virtualhost($site, 'dev'); $apache->add($virtualhost);