-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c236e73
commit 0572610
Showing
11 changed files
with
160 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
namespace Test\Altax\RemoteFile; | ||
|
||
use Altax\RemoteFile\RemoteFileBuilder; | ||
|
||
class RemoteFileProviderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function setup() | ||
{ | ||
$this->app = bootAltaxApplication(); | ||
} | ||
|
||
public function testRemoteFile() | ||
{ | ||
$obj = $this->app["remote_file"]; | ||
$this->assertTrue($obj instanceof RemoteFileBuilder); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
namespace Test\Altax\RemoteFile; | ||
|
||
use Symfony\Component\Console\Output\BufferedOutput; | ||
|
||
class CommandTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function setup() | ||
{ | ||
$this->app = bootAltaxApplication(); | ||
$this->app->instance("output", new BufferedOutput()); | ||
} | ||
|
||
public function testPutError() | ||
{ | ||
$remoteFileBuilder = $this->app["remote_file"]; | ||
$remoteFile = $remoteFileBuilder->make(); | ||
try { | ||
$remoteFile->put(__DIR__."/files/puttext.txt", "/tmp/puttext.txt"); | ||
$this->assertEquals(true, false); | ||
} catch (\Exception $e) { | ||
$this->assertTrue(true); | ||
} | ||
} | ||
|
||
public function testPut() | ||
{ | ||
$servers = $this->app['servers']; | ||
$servers->node("127.0.0.1"); | ||
$env = $this->app['env']; | ||
$env->set('process.parallel', false); | ||
|
||
$executor = $this->app['process.executor']; | ||
$executor->on(["127.0.0.1"], function(){ | ||
|
||
$remoteFileBuilder = $this->app["remote_file"]; | ||
$remoteFile = $remoteFileBuilder->make(); | ||
$remoteFile->put(__DIR__."/files/puttext.txt", __DIR__."/../../tmp/puttext.txt"); | ||
|
||
}); | ||
|
||
$this->assertTrue(file_exists(__DIR__."/../../tmp/puttext.txt")); | ||
unlink(__DIR__."/../../tmp/puttext.txt"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
put ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
namespace Test\Altax\Shell; | ||
|
||
use Symfony\Component\Console\Output\BufferedOutput; | ||
|
||
class CommandTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function setup() | ||
{ | ||
$this->app = bootAltaxApplication(); | ||
$this->app->instance("output", new BufferedOutput()); | ||
} | ||
|
||
public function testMakeAndRunOnLoccally() | ||
{ | ||
$commandBuilder = $this->app["shell.command"]; | ||
$command = $commandBuilder->make("pwd"); | ||
$command->run(); | ||
|
||
$this->assertRegExp("/Run command locally:/", $this->app['output']->fetch()); | ||
} | ||
|
||
public function testMakeAndRunOnRemotely() | ||
{ | ||
$servers = $this->app['servers']; | ||
$servers->node("127.0.0.1"); | ||
$env = $this->app['env']; | ||
$env->set('process.parallel', false); | ||
|
||
$executor = $this->app['process.executor']; | ||
$executor->on(["127.0.0.1"], function(){ | ||
|
||
$commandBuilder = $this->app["shell.command"]; | ||
$command = $commandBuilder->make("pwd"); | ||
$command->run(); | ||
|
||
}); | ||
|
||
$this->assertRegExp("/Run command: pwd on 127.0.0.1/", $this->app['output']->fetch()); | ||
} | ||
|
||
public function testRunOnLoccally() | ||
{ | ||
$commandBuilder = $this->app["shell.command"]; | ||
$commandBuilder->run("pwd"); | ||
|
||
$this->assertRegExp("/Run command locally:/", $this->app['output']->fetch()); | ||
} | ||
|
||
public function testRunOnRemotely() | ||
{ | ||
$servers = $this->app['servers']; | ||
$servers->node("127.0.0.1"); | ||
$env = $this->app['env']; | ||
$env->set('process.parallel', false); | ||
|
||
$executor = $this->app['process.executor']; | ||
$executor->on(["127.0.0.1"], function(){ | ||
|
||
$commandBuilder = $this->app["shell.command"]; | ||
$commandBuilder->run("pwd"); | ||
|
||
}); | ||
|
||
$this->assertRegExp("/Run command: pwd on 127.0.0.1/", $this->app['output']->fetch()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters