Add init command

This commit is contained in:
Nicolas Le Goff
2014-07-25 14:35:23 +02:00
parent 26190331ed
commit 9e2083dfe4
13 changed files with 297 additions and 111 deletions

View File

@@ -6,10 +6,7 @@ use Alchemy\Phrasea\Command\Setup\XSendFileMappingGenerator;
class XSendFileMappingGeneratorTest extends \PhraseanetPHPUnitAbstract
{
/**
* @dataProvider provideVariousOptions
*/
public function testRunWithoutProblems($option)
public function testRunWithoutProblems()
{
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface');
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
@@ -19,26 +16,13 @@ class XSendFileMappingGeneratorTest extends \PhraseanetPHPUnitAbstract
->with('type')
->will($this->returnValue('nginx'));
$input->expects($this->any())
->method('getOption')
->with($this->isType('string'))
->will($this->returnValue($option));
$command = new XSendFileMappingGenerator();
$phpunit = $this;
self::$DI['cli']['monolog'] = self::$DI['cli']->share(function () use ($phpunit) {
return $phpunit->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock();
});
self::$DI['cli']['phraseanet.configuration'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
if ($option) {
self::$DI['cli']['phraseanet.configuration']->expects($this->once())
->method('offsetSet')
->with('xsendfile');
} else {
self::$DI['cli']['phraseanet.configuration']->expects($this->never())
->method('offsetSet');
}
$command->setContainer(self::$DI['cli']);
$this->assertEquals(0, $command->execute($input, $output));
@@ -59,12 +43,4 @@ class XSendFileMappingGeneratorTest extends \PhraseanetPHPUnitAbstract
$this->setExpectedException('Alchemy\Phrasea\Exception\InvalidArgumentException');
$command->execute($input, $output);
}
public function provideVariousOptions()
{
return array(
array(true),
array(false),
);
}
}