Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kohkimakimoto committed Oct 28, 2014
1 parent 8c8cbc7 commit f14949e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/Altax/Shell/LocalCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace Test\Altax\Shell;

use Symfony\Component\Console\Output\BufferedOutput;

class LocalCommandTest extends \PHPUnit_Framework_TestCase
{
public function setup()
{
$this->app = bootAltaxApplication();
$this->app->instance("output", new BufferedOutput());
}

public function testMakeAndRun()
{
$commandBuilder = $this->app["shell.local_command"];
$command = $commandBuilder->make("pwd");
$command->run();
$this->assertRegExp("/Run local command: pwd/", $this->app['output']->fetch());
}

public function testRun()
{
$commandBuilder = $this->app["shell.local_command"];
$command = $commandBuilder->run("pwd");
$this->assertRegExp("/Run local command: pwd/", $this->app['output']->fetch());
}

public function testRunWithOptions()
{
$commandBuilder = $this->app["shell.local_command"];
$command = $commandBuilder->run("pwd", [
"cwd" => __DIR__,
"user" => get_current_user(),
"timeout" => 100,
]);
$this->assertRegExp("/Run local command: pwd/", $this->app['output']->fetch());
}

}

0 comments on commit f14949e

Please sign in to comment.