Skip to content

Commit

Permalink
Merge pull request consolidation#158 from fabfuel/master
Browse files Browse the repository at this point in the history
PhpServer: Wrap `php` command with `exec`
  • Loading branch information
DavertMik committed Apr 14, 2015
2 parents 0516822 + 615d4b4 commit b529585
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Task/Development/PhpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class PhpServer extends Exec
public function __construct($port)
{
$this->port = $port;

if (strtolower(PHP_OS) === 'linux') {
$this->command = 'exec php -S %s:%d ';
}
}

public function host($host)
Expand Down
11 changes: 9 additions & 2 deletions tests/unit/PHPServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,18 @@ public function testServerRun()

public function testServerCommand()
{
if (strtolower(PHP_OS) === 'linux') {
$expectedCommand = 'exec php -S 127.0.0.1:8000 -t web';
} else {
$expectedCommand = 'php -S 127.0.0.1:8000 -t web';
}

verify(
$this->taskServer('8000')
->host('127.0.0.1')
->dir('web')
->getCommand()
)->equals('php -S 127.0.0.1:8000 -t web');
)->equals($expectedCommand);
}

}
}

0 comments on commit b529585

Please sign in to comment.