mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
79 lines
2.8 KiB
PHP
79 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\Command\Developper;
|
|
|
|
use Alchemy\Phrasea\Command\Developer\BowerInstall;
|
|
|
|
/**
|
|
* @group functional
|
|
* @group legacy
|
|
*/
|
|
class BowerInstallTest extends \PhraseanetTestCase
|
|
{
|
|
public function testRunWithoutProblems()
|
|
{
|
|
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface');
|
|
$output = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
|
|
|
|
self::$DI['cli']['filesystem'] = $this->getMockBuilder('Symfony\Component\Filesystem\Filesystem')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
self::$DI['cli']['driver.bower'] = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
self::$DI['cli']['console'] = $this->getMockBuilder('Symfony\Component\Console\Application')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$mockedCommand = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
|
|
->setMethods(['execute'])
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
self::$DI['cli']['console']->expects($this->any())
|
|
->method('get')
|
|
->will($this->returnValue($mockedCommand));
|
|
|
|
self::$DI['cli']['driver.grunt'] = $this->getMockBuilder('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
$processBuilder = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
|
|
$processBuilder->expects($this->any())
|
|
->method('getBinary');
|
|
|
|
self::$DI['cli']['driver.bower']->expects($this->at(0))
|
|
->method('getProcessBuilderFactory')
|
|
->will($this->returnValue($processBuilder));
|
|
|
|
self::$DI['cli']['driver.bower']->expects($this->at(1))
|
|
->method('command')
|
|
->with('-v')
|
|
->will($this->returnValue('1.0.0-alpha.5'));
|
|
|
|
self::$DI['cli']['driver.grunt']->expects($this->at(0))
|
|
->method('getProcessBuilderFactory')
|
|
->will($this->returnValue($processBuilder));
|
|
|
|
self::$DI['cli']['driver.grunt']->expects($this->at(1))
|
|
->method('getProcessBuilderFactory')
|
|
->will($this->returnValue($processBuilder));
|
|
|
|
self::$DI['cli']['driver.grunt']->expects($this->at(2))
|
|
->method('command')
|
|
->with('--version')
|
|
->will($this->returnValue('4.0.1'));
|
|
|
|
self::$DI['cli']['driver.grunt']->expects($this->at(3))
|
|
->method('command')
|
|
->with('install-assets');
|
|
|
|
$command = new BowerInstall();
|
|
$command->setContainer(self::$DI['cli']);
|
|
|
|
$this->assertEquals(0, $command->execute($input, $output));
|
|
}
|
|
}
|