Refactoring
This commit is contained in:
30
lib/composer/vendor/consolidation/robo/tests/_helpers/CliGuy.php
vendored
Normal file
30
lib/composer/vendor/consolidation/robo/tests/_helpers/CliGuy.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
|
||||
use League\Container\ContainerAwareInterface;
|
||||
use League\Container\ContainerAwareTrait;
|
||||
|
||||
class CliGuy extends \Codeception\Actor
|
||||
{
|
||||
use _generated\CliGuyActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
66
lib/composer/vendor/consolidation/robo/tests/_helpers/CliHelper.php
vendored
Normal file
66
lib/composer/vendor/consolidation/robo/tests/_helpers/CliHelper.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace Codeception\Module;
|
||||
|
||||
use Robo\Robo;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
|
||||
use League\Container\ContainerAwareInterface;
|
||||
use League\Container\ContainerAwareTrait;
|
||||
|
||||
class CliHelper extends \Codeception\Module implements ContainerAwareInterface
|
||||
{
|
||||
use ContainerAwareTrait;
|
||||
use SeeInOutputTrait;
|
||||
|
||||
use \Robo\LoadAllTasks {
|
||||
task as public;
|
||||
taskExec as public;
|
||||
taskExecStack as public;
|
||||
taskWriteToFile as public;
|
||||
taskReplaceInFile as public;
|
||||
taskConcat as public;
|
||||
taskTmpFile as public;
|
||||
taskCleanDir as public;
|
||||
taskCopyDir as public;
|
||||
taskGenTask as public;
|
||||
taskDeleteDir as public;
|
||||
taskFlattenDir as public;
|
||||
taskFilesystemStack as public;
|
||||
taskTmpDir as public;
|
||||
taskMinify as public;
|
||||
_copyDir as public shortcutCopyDir;
|
||||
_mirrorDir as public shortcutMirrorDir;
|
||||
_tmpDir as public shortcutTmpDir;
|
||||
taskPack as public;
|
||||
taskExtract as public;
|
||||
}
|
||||
|
||||
public function collectionBuilder()
|
||||
{
|
||||
$tasks = new \Robo\Tasks();
|
||||
$builder = $this->getContainer()->get('collectionBuilder', [$tasks]);
|
||||
$tasks->setBuilder($builder);
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function seeDirFound($dir)
|
||||
{
|
||||
$this->assertTrue(is_dir($dir) && file_exists($dir), "Directory does not exist");
|
||||
}
|
||||
|
||||
public function _before(\Codeception\TestCase $test) {
|
||||
$container = new \League\Container\Container();
|
||||
$this->initSeeInOutputTrait($container);
|
||||
Robo::setContainer($container);
|
||||
$this->setContainer($container);
|
||||
|
||||
$this->getModule('Filesystem')->copyDir(codecept_data_dir().'claypit', codecept_data_dir().'sandbox');
|
||||
}
|
||||
|
||||
public function _after(\Codeception\TestCase $test) {
|
||||
$this->getModule('Filesystem')->deleteDir(codecept_data_dir().'sandbox');
|
||||
$this->getContainer()->add('output', new ConsoleOutput());
|
||||
chdir(codecept_root_dir());
|
||||
}
|
||||
}
|
||||
26
lib/composer/vendor/consolidation/robo/tests/_helpers/CodeGuy.php
vendored
Normal file
26
lib/composer/vendor/consolidation/robo/tests/_helpers/CodeGuy.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class CodeGuy extends \Codeception\Actor
|
||||
{
|
||||
use _generated\CodeGuyActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
37
lib/composer/vendor/consolidation/robo/tests/_helpers/CodeHelper.php
vendored
Normal file
37
lib/composer/vendor/consolidation/robo/tests/_helpers/CodeHelper.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace Codeception\Module;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
use Robo\Robo;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class CodeHelper extends \Codeception\Module
|
||||
{
|
||||
use SeeInOutputTrait;
|
||||
|
||||
protected static $container;
|
||||
|
||||
public function _before(\Codeception\TestCase $test)
|
||||
{
|
||||
static::$container = new \League\Container\Container();
|
||||
Robo::setContainer(static::$container);
|
||||
$this->initSeeInOutputTrait(static::$container);
|
||||
}
|
||||
|
||||
public function _after(\Codeception\TestCase $test)
|
||||
{
|
||||
// Ensure that $stopOnFail global static is reset, as tests
|
||||
// that set it to true will force an exception, and therefor
|
||||
// will not have a chance to clean this up.
|
||||
\Robo\Result::$stopOnFail = false;
|
||||
|
||||
\AspectMock\Test::clean();
|
||||
$consoleOutput = new ConsoleOutput();
|
||||
static::$container->add('output', $consoleOutput);
|
||||
static::$container->add('logger', new \Consolidation\Log\Logger($consoleOutput));
|
||||
}
|
||||
}
|
||||
62
lib/composer/vendor/consolidation/robo/tests/_helpers/SeeInOutputTrait.php
vendored
Normal file
62
lib/composer/vendor/consolidation/robo/tests/_helpers/SeeInOutputTrait.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace Codeception\Module;
|
||||
|
||||
use Robo\Robo;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
trait SeeInOutputTrait
|
||||
{
|
||||
protected $testPrinter;
|
||||
protected $capturedOutput;
|
||||
protected $logger;
|
||||
|
||||
public function initSeeInOutputTrait($container, $input = null)
|
||||
{
|
||||
$this->capturedOutput = '';
|
||||
$this->testPrinter = new BufferedOutput(OutputInterface::VERBOSITY_DEBUG);
|
||||
|
||||
$app = Robo::createDefaultApplication();
|
||||
$config = new \Robo\Config();
|
||||
\Robo\Robo::configureContainer($container, $app, $config, $input, $this->testPrinter);
|
||||
|
||||
// Set the application dispatcher
|
||||
$app->setDispatcher($container->get('eventDispatcher'));
|
||||
$this->logger = $container->get('logger');
|
||||
}
|
||||
|
||||
public function capturedOutputStream()
|
||||
{
|
||||
return $this->testPrinter;
|
||||
}
|
||||
|
||||
public function logger()
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
protected function accumulate()
|
||||
{
|
||||
$this->capturedOutput .= $this->testPrinter->fetch();
|
||||
return $this->capturedOutput;
|
||||
}
|
||||
|
||||
public function seeInOutput($value)
|
||||
{
|
||||
$output = $this->accumulate();
|
||||
$this->assertContains($value, $output);
|
||||
}
|
||||
|
||||
public function doNotSeeInOutput($value)
|
||||
{
|
||||
$output = $this->accumulate();
|
||||
$this->assertNotContains($value, $output);
|
||||
}
|
||||
|
||||
public function seeOutputEquals($value)
|
||||
{
|
||||
$output = $this->accumulate();
|
||||
$this->assertEquals($value, $output);
|
||||
}
|
||||
}
|
||||
10
lib/composer/vendor/consolidation/robo/tests/_helpers/TestHelper.php
vendored
Normal file
10
lib/composer/vendor/consolidation/robo/tests/_helpers/TestHelper.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Codeception\Module;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class TestHelper extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
||||
10
lib/composer/vendor/consolidation/robo/tests/_helpers/WebHelper.php
vendored
Normal file
10
lib/composer/vendor/consolidation/robo/tests/_helpers/WebHelper.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Codeception\Module;
|
||||
|
||||
// here you can define custom actions
|
||||
// all public methods declared in helper class will be available in $I
|
||||
|
||||
class WebHelper extends \Codeception\Module
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user