Refactor command line utilities

This commit is contained in:
Romain Neutron
2013-07-16 16:01:17 +02:00
parent 86e108b20f
commit 056ac28120
59 changed files with 1031 additions and 592 deletions

View File

@@ -12,7 +12,7 @@ class CustomCommand extends Command
{
parent::__construct('hello:world');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->write('Hello World');

View File

@@ -3,6 +3,7 @@
namespace Alchemy\Phrasea\Plugin\Management;
use Alchemy\Phrasea\Plugin\Management\ComposerInstaller;
use Alchemy\Phrasea\Utilities\ComposerSetup;
use Guzzle\Http\Client as Guzzle;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Filesystem\Filesystem;
@@ -26,7 +27,11 @@ class ComposerInstallerTest extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('Unable to find PHP executable.');
}
$installer = new ComposerInstaller(__DIR__, new Guzzle(), $php);
$setupMock = $this->getMockBuilder('Alchemy\Phrasea\Utilities\ComposerSetup')
->disableOriginalConstructor()
->getMock();
$installer = new ComposerInstaller(new ComposerSetup(new Guzzle()), __DIR__, $php);
$installer->install(__DIR__ . '/../Fixtures/PluginDir/TestPlugin');
$this->assertFileExists($composer);

View File

@@ -8,7 +8,7 @@ class PluginTestCase extends \PhraseanetPHPUnitAbstract
{
protected function createManifestValidator()
{
return ManifestValidator::create(self::$DI['app']);
return ManifestValidator::create(self::$DI['cli']);
}
protected function getPluginDirectory()

View File

@@ -62,12 +62,12 @@ class ManifestValidatorTest extends PluginTestCase
*/
public function testConstructWithInvalidSchema()
{
new ManifestValidator(new JsonSchemaValidator(), array(), self::$DI['app']['phraseanet.version']);
new ManifestValidator(new JsonSchemaValidator(), array(), self::$DI['cli']['phraseanet.version']);
}
public function testCreate()
{
$validator = ManifestValidator::create(self::$DI['app']);
$validator = ManifestValidator::create(self::$DI['cli']);
$this->assertInstanceOf('Alchemy\Phrasea\Plugin\Schema\ManifestValidator', $validator);
}
@@ -76,6 +76,6 @@ class ManifestValidatorTest extends PluginTestCase
{
$schema = json_decode($this->getSchema());
return new ManifestValidator(new JsonSchemaValidator(), $schema, self::$DI['app']['phraseanet.version']);
return new ManifestValidator(new JsonSchemaValidator(), $schema, self::$DI['cli']['phraseanet.version']);
}
}