remove recess, bower, grunt and uglifyJs dependencies in php utils and tests

updated minifier tests
This commit is contained in:
Florian BLOUET
2015-12-02 17:16:47 +01:00
parent 82a35ce457
commit 261339ecd5
50 changed files with 19 additions and 993 deletions

View File

@@ -1,78 +0,0 @@
<?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));
}
}

View File

@@ -21,8 +21,7 @@ class InstallAllTest extends \PhraseanetTestCase
$n = 0;
foreach ([
'dependencies:composer',
'dependencies:bower'
'dependencies:composer'
] as $name) {
$command = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
->setMethods(['execute'])

View File

@@ -1,30 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
use Alchemy\Phrasea\Command\Developer\Utils\BowerDriver;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* @group functional
* @group legacy
*/
class BowerDriverTest extends \PhraseanetTestCase
{
public function testCreate()
{
$driver = BowerDriver::create();
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver', $driver);
$this->assertEquals('bower', $driver->getName());
}
public function testCreateWithCustomBinary()
{
$finder = new PhpExecutableFinder();
$php = $finder->find();
$driver = BowerDriver::create(['bower.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
use Alchemy\Phrasea\Command\Developer\Utils\GruntDriver;
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* @group functional
* @group legacy
*/
class GruntDriverTest extends \PhraseanetTestCase
{
public function testCreate()
{
$app = $this->getApplication();
$app->register(new CLIDriversServiceProvider());
$driver = GruntDriver::create(['grunt.binaries' => $app['driver.binary-finder']('grunt', 'grunt_binary')]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver);
$this->assertEquals('grunt', $driver->getName());
}
public function testCreateWithCustomBinary()
{
$finder = new PhpExecutableFinder();
$php = $finder->find();
$driver = GruntDriver::create(['grunt.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
}

View File

@@ -1,26 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
use Alchemy\Phrasea\Command\Developer\Utils\RecessDriver;
/**
* @group functional
* @group legacy
*/
class RecessDriverTest extends \PhraseanetTestCase
{
public function testGetCreate()
{
$recessDriver = RecessDriver::create();
$this->assertInstanceOf('Alchemy\BinaryDriver\BinaryInterface', $recessDriver);
}
public function testGetName()
{
$recessDriver = RecessDriver::create();
$this->assertEquals('recess', $recessDriver->getName());
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\Command\Developper\Utils;
use Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver;
use Alchemy\Phrasea\Core\CLIProvider\CLIDriversServiceProvider;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* @group functional
* @group legacy
*/
class UglifyJsDriverTest extends \PhraseanetTestCase
{
public function testCreate()
{
$app = $this->getApplication();
$app->register(new CLIDriversServiceProvider());
$driver = UglifyJsDriver::create(['uglifyjs.binaries' => $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary')]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver);
$this->assertEquals('uglifyjs', $driver->getName());
}
public function testCreateWithCustomBinary()
{
$finder = new PhpExecutableFinder();
$php = $finder->find();
$driver = UglifyJsDriver::create(['uglifyjs.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
}