mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
[Nostromo] Add tests
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace Mage\Tests\Runtime;
|
||||
|
||||
use Mage\Runtime\Runtime;
|
||||
use Mage\Runtime\RuntimeInterface;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class RuntimeMockup extends Runtime
|
||||
{
|
||||
protected $ranCommands = [];
|
||||
|
||||
public function getRanCommands()
|
||||
{
|
||||
return $this->ranCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the Release ID
|
||||
*
|
||||
* @return RuntimeInterface
|
||||
*/
|
||||
public function generateReleaseId()
|
||||
{
|
||||
$this->setReleaseId('1234567890');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a command locally
|
||||
*
|
||||
* @param string $cmd Command to execute
|
||||
* @param int $timeout Seconds to wait
|
||||
* @return Process
|
||||
*/
|
||||
public function runLocalCommand($cmd, $timeout = 120)
|
||||
{
|
||||
$this->ranCommands[] = $cmd;
|
||||
|
||||
$process = new ProcessMockup($cmd);
|
||||
$process->setTimeout($timeout);
|
||||
$process->run();
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Temporal File name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTempFile()
|
||||
{
|
||||
return '/tmp/mageXYZ';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user