diff --git a/.styleci.yml b/.styleci.yml
index b88748db9..1396733db 100644
--- a/.styleci.yml
+++ b/.styleci.yml
@@ -1,5 +1,3 @@
----
-
preset: symfony
enabled:
@@ -16,5 +14,3 @@ finder :
name : [ "*.php", "*.twig" ]
exclude : [ "vendor", "var" ]
path : [ "./" ]
-
-...
diff --git a/.travis.yml b/.travis.yml
index f954b0a8c..4e5933ce4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,10 @@
----
-
sudo: false
language: php
php:
- 7.1
- - nightly
+ - 7.2
cache:
directories:
@@ -15,15 +13,11 @@ cache:
env:
global:
- SYMFONY_DEPRECATIONS_HELPER=weak
- - SYMFONY_VERSION=3.2.x-dev
+ - SYMFONY_VERSION=3.4.*
matrix:
include:
- - env: SYMFONY_VERSION=3.3.x-dev
- - env: SYMFONY_VERSION=3.4.x-dev
- - env: SYMFONY_VERSION=4.0.x-dev
- allow_failures:
- - php: nightly
+ - env: SYMFONY_VERSION=4.0.*
fast_finish: true
before_install:
@@ -33,9 +27,7 @@ install:
- travis_retry composer require "symfony/symfony:${SYMFONY_VERSION}" $COMPOSER_FLAGS
script:
- - bin/simple-phpunit -vvv || bin/phpunit -vvv
+ - ./vendor/bin/simple-phpunit -vvv || ./vendor/bin/phpunit -vvv
after_script:
- - bash ./.travis/exec-after.bash
-
-...
+ - bash ./.travis/exec-after.bash
\ No newline at end of file
diff --git a/Command/RemoveCacheCommand.php b/Command/RemoveCacheCommand.php
index c08824067..0b40d66be 100644
--- a/Command/RemoveCacheCommand.php
+++ b/Command/RemoveCacheCommand.php
@@ -12,18 +12,27 @@
namespace Liip\ImagineBundle\Command;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-class RemoveCacheCommand extends ContainerAwareCommand
+class RemoveCacheCommand extends Command
{
+ /* @var CacheManager cacheManager */
+ private $cacheManager;
+
+ public function __construct(CacheManager $cacheManager)
+ {
+ $this->cacheManager = $cacheManager;
+
+ parent::__construct('liip:imagine:cache:remove');
+ }
+
protected function configure()
{
$this
- ->setName('liip:imagine:cache:remove')
->setDescription('Remove cache for given paths and set of filters.')
->addArgument('paths', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Image paths')
->addOption(
@@ -61,9 +70,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$filters = null;
}
- /* @var CacheManager cacheManager */
- $cacheManager = $this->getContainer()->get('liip_imagine.cache.manager');
-
- $cacheManager->remove($paths, $filters);
+ $this->cacheManager->remove($paths, $filters);
}
}
diff --git a/Command/ResolveCacheCommand.php b/Command/ResolveCacheCommand.php
index ae519dd57..5a015e490 100644
--- a/Command/ResolveCacheCommand.php
+++ b/Command/ResolveCacheCommand.php
@@ -13,18 +13,31 @@
use Liip\ImagineBundle\Imagine\Filter\FilterManager;
use Liip\ImagineBundle\Service\FilterService;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-class ResolveCacheCommand extends ContainerAwareCommand
+class ResolveCacheCommand extends Command
{
+ /* @var FilterManager $filterManager */
+ private $filterManager;
+
+ /* @var FilterService $filterService */
+ private $filterService;
+
+ public function __construct(FilterManager $filterManager, FilterService $filterService)
+ {
+ $this->filterManager = $filterManager;
+ $this->filterService = $filterService;
+
+ parent::__construct('liip:imagine:cache:resolve');
+ }
+
protected function configure()
{
$this
- ->setName('liip:imagine:cache:resolve')
->setDescription('Resolve cache for given path and set of filters.')
->addArgument('paths', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Image paths')
->addOption(
@@ -62,19 +75,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$paths = $input->getArgument('paths');
$filters = $input->getOption('filters');
- /* @var FilterManager $filterManager */
- $filterManager = $this->getContainer()->get('liip_imagine.filter.manager');
-
- /* @var FilterService $filterService */
- $filterService = $this->getContainer()->get('liip_imagine.service.filter');
-
if (empty($filters)) {
- $filters = array_keys($filterManager->getFilterConfiguration()->all());
+ $filters = array_keys($this->filterManager->getFilterConfiguration()->all());
}
foreach ($paths as $path) {
foreach ($filters as $filter) {
- $output->writeln($filterService->getUrlOfFilteredImage($path, $filter));
+ $output->writeln($this->filterService->getUrlOfFilteredImage($path, $filter));
}
}
}
diff --git a/DependencyInjection/Factory/ChildDefinitionTrait.php b/DependencyInjection/Factory/ChildDefinitionTrait.php
index 4606043d1..33d49c433 100644
--- a/DependencyInjection/Factory/ChildDefinitionTrait.php
+++ b/DependencyInjection/Factory/ChildDefinitionTrait.php
@@ -12,16 +12,14 @@
namespace Liip\ImagineBundle\DependencyInjection\Factory;
use Symfony\Component\DependencyInjection\ChildDefinition;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
trait ChildDefinitionTrait
{
/**
- * @return ChildDefinition|DefinitionDecorator
+ * @return ChildDefinition
*/
private function getChildDefinition($parent)
{
- return class_exists(ChildDefinition::class) ?
- new ChildDefinition($parent) : new DefinitionDecorator($parent);
+ return new ChildDefinition($parent);
}
}
diff --git a/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php b/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php
index 5bcb26e75..3471b6246 100644
--- a/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php
+++ b/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php
@@ -47,6 +47,8 @@ final protected function setTaggedLoaderDefinition($name, Definition $definition
'loader' => $name,
]);
+ $definition->setPublic(true);
+
$container->setDefinition(
$id = sprintf('%s.%s', static::$namePrefix, $name),
$definition
diff --git a/DependencyInjection/LiipImagineExtension.php b/DependencyInjection/LiipImagineExtension.php
index 975ff2650..100c12c5e 100644
--- a/DependencyInjection/LiipImagineExtension.php
+++ b/DependencyInjection/LiipImagineExtension.php
@@ -71,6 +71,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('imagine.xml');
+ $loader->load('commands.xml');
if ($config['enqueue']) {
$loader->load('enqueue.xml');
diff --git a/Resources/config/commands.xml b/Resources/config/commands.xml
new file mode 100644
index 000000000..8672734ea
--- /dev/null
+++ b/Resources/config/commands.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Resources/config/imagine.xml b/Resources/config/imagine.xml
index ae7ef6ea3..6c293909b 100644
--- a/Resources/config/imagine.xml
+++ b/Resources/config/imagine.xml
@@ -34,13 +34,13 @@
-
+
-
+
@@ -117,7 +117,7 @@
-
+
@@ -150,7 +150,7 @@
-
+
@@ -158,15 +158,15 @@
-
+
-
+
-
+
@@ -259,7 +259,7 @@
-
+
%kernel.secret%
diff --git a/Tests/AbstractTest.php b/Tests/AbstractTest.php
index f8bd34d29..89ab347cc 100644
--- a/Tests/AbstractTest.php
+++ b/Tests/AbstractTest.php
@@ -30,7 +30,7 @@
use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface;
use Symfony\Component\Routing\RouterInterface;
-abstract class AbstractTest extends \PHPUnit_Framework_TestCase
+abstract class AbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Filesystem
diff --git a/Tests/Async/CacheResolvedTest.php b/Tests/Async/CacheResolvedTest.php
index d468da10f..75eea43d6 100644
--- a/Tests/Async/CacheResolvedTest.php
+++ b/Tests/Async/CacheResolvedTest.php
@@ -5,7 +5,7 @@
use Enqueue\Bundle\EnqueueBundle;
use Liip\ImagineBundle\Async\CacheResolved;
-class CacheResolvedTest extends \PHPUnit_Framework_TestCase
+class CacheResolvedTest extends \PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass()
{
diff --git a/Tests/Async/ResolveCacheProcessorTest.php b/Tests/Async/ResolveCacheProcessorTest.php
index e559f7059..2ac49846c 100644
--- a/Tests/Async/ResolveCacheProcessorTest.php
+++ b/Tests/Async/ResolveCacheProcessorTest.php
@@ -69,11 +69,13 @@ public function testShouldSubscribeToExpectedQueue()
public function testCouldBeConstructedWithExpectedArguments()
{
- new ResolveCacheProcessor(
+ $processor = new ResolveCacheProcessor(
$this->createFilterManagerMock(),
$this->createFilterServiceMock(),
$this->createProducerMock()
);
+
+ $this->assertInstanceOf(ResolveCacheProcessor::class, $processor);
}
public function testShouldRejectMessagesWithInvalidJsonBody()
diff --git a/Tests/Async/ResolveCacheTest.php b/Tests/Async/ResolveCacheTest.php
index 88e38b586..8a62e1766 100644
--- a/Tests/Async/ResolveCacheTest.php
+++ b/Tests/Async/ResolveCacheTest.php
@@ -5,7 +5,7 @@
use Enqueue\Bundle\EnqueueBundle;
use Liip\ImagineBundle\Async\ResolveCache;
-class ResolveCacheTest extends \PHPUnit_Framework_TestCase
+class ResolveCacheTest extends \PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass()
{
diff --git a/Tests/Binary/Loader/AbstractDoctrineLoaderTest.php b/Tests/Binary/Loader/AbstractDoctrineLoaderTest.php
index ef18812cb..16a7f23e0 100644
--- a/Tests/Binary/Loader/AbstractDoctrineLoaderTest.php
+++ b/Tests/Binary/Loader/AbstractDoctrineLoaderTest.php
@@ -18,7 +18,7 @@
/**
* @covers \Liip\ImagineBundle\Binary\Loader\AbstractDoctrineLoader
*/
-class AbstractDoctrineLoaderTest extends \PHPUnit_Framework_TestCase
+class AbstractDoctrineLoaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|ObjectRepository
diff --git a/Tests/Binary/Loader/FileSystemLoaderTest.php b/Tests/Binary/Loader/FileSystemLoaderTest.php
index 35c1b9140..3259fe626 100644
--- a/Tests/Binary/Loader/FileSystemLoaderTest.php
+++ b/Tests/Binary/Loader/FileSystemLoaderTest.php
@@ -22,11 +22,13 @@
/**
* @covers \Liip\ImagineBundle\Binary\Loader\FileSystemLoader
*/
-class FileSystemLoaderTest extends \PHPUnit_Framework_TestCase
+class FileSystemLoaderTest extends \PHPUnit\Framework\TestCase
{
public function testConstruction()
{
- $this->getFileSystemLoader();
+ $loader = $this->getFileSystemLoader();
+
+ $this->assertInstanceOf(FileSystemLoader::class, $loader);
}
public function testImplementsLoaderInterface()
@@ -109,7 +111,9 @@ public function testMultipleRootLoadCases($root, $path)
public function testAllowsEmptyRootPath()
{
- $this->getFileSystemLoader(array());
+ $loader = $this->getFileSystemLoader(array());
+
+ $this->assertInstanceOf(FileSystemLoader::class, $loader);
}
/**
@@ -118,7 +122,9 @@ public function testAllowsEmptyRootPath()
*/
public function testThrowsIfRootPathDoesNotExist()
{
- $this->getFileSystemLoader(array('/a/bad/root/path'));
+ $loader = $this->getFileSystemLoader(array('/a/bad/root/path'));
+
+ $this->assertInstanceOf(FileSystemLoader::class, $loader);
}
/**
@@ -140,7 +146,9 @@ public function provideOutsideRootPathsData()
*/
public function testThrowsIfRealPathOutsideRootPath($path)
{
- $this->getFileSystemLoader()->find($path);
+ $loader = $this->getFileSystemLoader()->find($path);
+
+ $this->assertInstanceOf(FileSystemLoader::class, $loader);
}
public function testPathWithDoublePeriodBackStep()
@@ -154,7 +162,9 @@ public function testPathWithDoublePeriodBackStep()
*/
public function testThrowsIfFileDoesNotExist()
{
- $this->getFileSystemLoader()->find('fileNotExist');
+ $loader = $this->getFileSystemLoader()->find('fileNotExist');
+
+ $this->assertInstanceOf(FileSystemLoader::class, $loader);
}
/**
diff --git a/Tests/Binary/Loader/FlysystemLoaderTest.php b/Tests/Binary/Loader/FlysystemLoaderTest.php
index 3afb75d77..2d6e7f2e9 100644
--- a/Tests/Binary/Loader/FlysystemLoaderTest.php
+++ b/Tests/Binary/Loader/FlysystemLoaderTest.php
@@ -38,13 +38,13 @@ public function setUp()
$this->flyFilesystem = new Filesystem(new Local($this->fixturesPath));
}
- public function testConstruction()
+ public function getLoader()
{
return new FlysystemLoader(ExtensionGuesser::getInstance(), $this->flyFilesystem);
}
/**
- * @depends testConstruction
+ * @depends getLoader
*/
public function testShouldImplementLoaderInterface(LoaderInterface $loader)
{
@@ -52,7 +52,7 @@ public function testShouldImplementLoaderInterface(LoaderInterface $loader)
}
/**
- * @depends testConstruction
+ * @depends getLoader
*/
public function testReturnImageContentOnFind(LoaderInterface $loader)
{
@@ -63,7 +63,7 @@ public function testReturnImageContentOnFind(LoaderInterface $loader)
}
/**
- * @depends testConstruction
+ * @depends getLoader
*
* @expectedException \Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException
* @expectedExceptionMessageRegExp {Source image .+ not found}
diff --git a/Tests/Binary/Locator/AbstractFileSystemLocatorTest.php b/Tests/Binary/Locator/AbstractFileSystemLocatorTest.php
index 9be89abed..3118ec7a5 100644
--- a/Tests/Binary/Locator/AbstractFileSystemLocatorTest.php
+++ b/Tests/Binary/Locator/AbstractFileSystemLocatorTest.php
@@ -14,7 +14,7 @@
use Liip\ImagineBundle\Binary\Locator\FileSystemLocator;
use Liip\ImagineBundle\Binary\Locator\LocatorInterface;
-abstract class AbstractFileSystemLocatorTest extends \PHPUnit_Framework_TestCase
+abstract class AbstractFileSystemLocatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @param string[]|string $paths
diff --git a/Tests/Binary/SimpleMimeTypeGuesserTest.php b/Tests/Binary/SimpleMimeTypeGuesserTest.php
index 84d2fd802..f374f0855 100644
--- a/Tests/Binary/SimpleMimeTypeGuesserTest.php
+++ b/Tests/Binary/SimpleMimeTypeGuesserTest.php
@@ -18,7 +18,7 @@
/**
* @covers \Liip\ImagineBundle\Binary\SimpleMimeTypeGuesser
*/
-class SimpleMimeTypeGuesserTest extends \PHPUnit_Framework_TestCase
+class SimpleMimeTypeGuesserTest extends \PHPUnit\Framework\TestCase
{
/**
* @return SimpleMimeTypeGuesser
@@ -30,7 +30,9 @@ private function getSimpleMimeTypeGuesser()
public function testCouldBeConstructedWithSymfonyMimeTypeGuesserAsFirstArgument()
{
- $this->getSimpleMimeTypeGuesser();
+ $guesser = $this->getSimpleMimeTypeGuesser();
+
+ $this->assertInstanceOf(SimpleMimeTypeGuesser::class, $guesser);
}
public function testImplementsMimeTypeGuesserInterface()
diff --git a/Tests/Controller/ImagineControllerTest.php b/Tests/Controller/ImagineControllerTest.php
index e637d57ee..90d7f14be 100644
--- a/Tests/Controller/ImagineControllerTest.php
+++ b/Tests/Controller/ImagineControllerTest.php
@@ -21,10 +21,12 @@ class ImagineControllerTest extends AbstractTest
{
public function testConstruction()
{
- new ImagineController(
+ $controller = new ImagineController(
$this->createFilterServiceMock(),
$this->createDataManagerMock(),
$this->createSignerInterfaceMock()
);
+
+ $this->assertInstanceOf(ImagineController::class, $controller);
}
}
diff --git a/Tests/DependencyInjection/Compiler/MetadataReaderCompilerPassTest.php b/Tests/DependencyInjection/Compiler/MetadataReaderCompilerPassTest.php
index 62832483e..52692fbfc 100644
--- a/Tests/DependencyInjection/Compiler/MetadataReaderCompilerPassTest.php
+++ b/Tests/DependencyInjection/Compiler/MetadataReaderCompilerPassTest.php
@@ -19,7 +19,7 @@
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Compiler\MetadataReaderCompilerPass
*/
-class MetadataReaderCompilerPassTest extends \PHPUnit_Framework_TestCase
+class MetadataReaderCompilerPassTest extends \PHPUnit\Framework\TestCase
{
/**
* @param \ReflectionClass $r
diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php
index 9023e2b5a..3db05d69a 100644
--- a/Tests/DependencyInjection/ConfigurationTest.php
+++ b/Tests/DependencyInjection/ConfigurationTest.php
@@ -24,7 +24,7 @@
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Configuration
*/
-class ConfigurationTest extends \Phpunit_Framework_TestCase
+class ConfigurationTest extends \PHPUnit\Framework\TestCase
{
public function testImplementsConfigurationInterface()
{
@@ -35,7 +35,9 @@ public function testImplementsConfigurationInterface()
public function testCouldBeConstructedWithResolversAndLoadersFactoriesAsArguments()
{
- new Configuration(array(), array());
+ $config = new Configuration(array(), array());
+
+ $this->assertInstanceOf(Configuration::class, $config);
}
public function testInjectLoaderFactoryConfig()
diff --git a/Tests/DependencyInjection/Factory/FactoryTestCase.php b/Tests/DependencyInjection/Factory/FactoryTestCase.php
index 3ae08e72c..9a6c20eb4 100644
--- a/Tests/DependencyInjection/Factory/FactoryTestCase.php
+++ b/Tests/DependencyInjection/Factory/FactoryTestCase.php
@@ -13,17 +13,14 @@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Definition;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
-abstract class FactoryTestCase extends \Phpunit_Framework_TestCase
+abstract class FactoryTestCase extends \PHPUnit\Framework\TestCase
{
/**
* @param Definition $definition
*/
protected function assertInstanceOfChildDefinition(Definition $definition)
{
- $expected = class_exists(ChildDefinition::class) ? ChildDefinition::class : DefinitionDecorator::class;
-
- $this->assertInstanceOf($expected, $definition);
+ $this->assertInstanceOf(ChildDefinition::class, $definition);
}
}
diff --git a/Tests/DependencyInjection/Factory/Loader/FileSystemLoaderFactoryTest.php b/Tests/DependencyInjection/Factory/Loader/FileSystemLoaderFactoryTest.php
index 2389efcbf..234c1d211 100644
--- a/Tests/DependencyInjection/Factory/Loader/FileSystemLoaderFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Loader/FileSystemLoaderFactoryTest.php
@@ -34,7 +34,9 @@ public function testImplementsLoaderFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new FileSystemLoaderFactory();
+ $loader = new FileSystemLoaderFactory();
+
+ $this->assertInstanceOf(FileSystemLoaderFactory::class, $loader);
}
public function testReturnExpectedName()
diff --git a/Tests/DependencyInjection/Factory/Loader/FlysystemLoaderFactoryTest.php b/Tests/DependencyInjection/Factory/Loader/FlysystemLoaderFactoryTest.php
index 7b37f9b5c..ace46257c 100644
--- a/Tests/DependencyInjection/Factory/Loader/FlysystemLoaderFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Loader/FlysystemLoaderFactoryTest.php
@@ -17,14 +17,14 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\ChildDefinition;
/**
* @requires PHP 5.4
*
* @covers \Liip\ImagineBundle\DependencyInjection\Factory\Loader\FlysystemLoaderFactory
*/
-class FlysystemLoaderFactoryTest extends \Phpunit_Framework_TestCase
+class FlysystemLoaderFactoryTest extends \PHPUnit\Framework\TestCase
{
public function setUp()
{
@@ -44,7 +44,9 @@ public function testImplementsLoaderFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new FlysystemLoaderFactory();
+ $loader = new FlysystemLoaderFactory();
+
+ $this->assertInstanceOf(FlysystemLoaderFactory::class, $loader);
}
public function testReturnExpectedName()
@@ -67,7 +69,7 @@ public function testCreateLoaderDefinitionOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.binary.loader.the_loader_name'));
$loaderDefinition = $container->getDefinition('liip_imagine.binary.loader.the_loader_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $loaderDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $loaderDefinition);
$this->assertEquals('liip_imagine.binary.loader.prototype.flysystem', $loaderDefinition->getParent());
$reference = $loaderDefinition->getArgument(1);
diff --git a/Tests/DependencyInjection/Factory/Loader/StreamLoaderFactoryTest.php b/Tests/DependencyInjection/Factory/Loader/StreamLoaderFactoryTest.php
index d9c6457d6..4a6a5b855 100644
--- a/Tests/DependencyInjection/Factory/Loader/StreamLoaderFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Loader/StreamLoaderFactoryTest.php
@@ -16,12 +16,12 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\ChildDefinition;
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Factory\Loader\StreamLoaderFactory
*/
-class StreamLoaderFactoryTest extends \Phpunit_Framework_TestCase
+class StreamLoaderFactoryTest extends \PHPUnit\Framework\TestCase
{
public function testImplementsLoaderFactoryInterface()
{
@@ -32,7 +32,9 @@ public function testImplementsLoaderFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new StreamLoaderFactory();
+ $loader = new StreamLoaderFactory();
+
+ $this->assertInstanceOf(StreamLoaderFactory::class, $loader);
}
public function testReturnExpectedName()
@@ -56,7 +58,7 @@ public function testCreateLoaderDefinitionOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.binary.loader.the_loader_name'));
$loaderDefinition = $container->getDefinition('liip_imagine.binary.loader.the_loader_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $loaderDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $loaderDefinition);
$this->assertEquals('liip_imagine.binary.loader.prototype.stream', $loaderDefinition->getParent());
$this->assertEquals('theWrapper', $loaderDefinition->getArgument(0));
diff --git a/Tests/DependencyInjection/Factory/Resolver/AwsS3ResolverFactoryTest.php b/Tests/DependencyInjection/Factory/Resolver/AwsS3ResolverFactoryTest.php
index 4c614f0a7..7e07d7864 100644
--- a/Tests/DependencyInjection/Factory/Resolver/AwsS3ResolverFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Resolver/AwsS3ResolverFactoryTest.php
@@ -16,13 +16,13 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Reference;
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Factory\Resolver\AwsS3ResolverFactory
*/
-class AwsS3ResolverFactoryTest extends \Phpunit_Framework_TestCase
+class AwsS3ResolverFactoryTest extends \PHPUnit\Framework\TestCase
{
public function testImplementsResolverFactoryInterface()
{
@@ -33,7 +33,9 @@ public function testImplementsResolverFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new AwsS3ResolverFactory();
+ $loader = new AwsS3ResolverFactory();
+
+ $this->assertInstanceOf(AwsS3ResolverFactory::class, $loader);
}
public function testReturnExpectedName()
@@ -62,7 +64,7 @@ public function testCreateResolverDefinitionOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.aws_s3', $resolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $resolverDefinition->getArgument(0));
@@ -135,14 +137,14 @@ public function testWrapResolverWithProxyOnCreateWithoutCache()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied'));
$proxiedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied');
- $this->assertInstanceOf(DefinitionDecorator::class, $proxiedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $proxiedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.aws_s3', $proxiedResolverDefinition->getParent());
$this->assertFalse($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.cached'));
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.proxy', $resolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $resolverDefinition->getArgument(0));
@@ -169,14 +171,14 @@ public function testWrapResolverWithCacheOnCreateWithoutProxy()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.cached'));
$cachedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.cached');
- $this->assertInstanceOf(DefinitionDecorator::class, $cachedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $cachedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.aws_s3', $cachedResolverDefinition->getParent());
$this->assertFalse($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied'));
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.cache', $resolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $resolverDefinition->getArgument(0));
@@ -204,12 +206,12 @@ public function testWrapResolverWithProxyAndCacheOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied'));
$proxiedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied');
- $this->assertInstanceOf(DefinitionDecorator::class, $proxiedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $proxiedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.aws_s3', $proxiedResolverDefinition->getParent());
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.cached'));
$cachedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.cached');
- $this->assertInstanceOf(DefinitionDecorator::class, $cachedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $cachedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.proxy', $cachedResolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $cachedResolverDefinition->getArgument(0));
@@ -219,7 +221,7 @@ public function testWrapResolverWithProxyAndCacheOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.cache', $resolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $resolverDefinition->getArgument(0));
@@ -247,12 +249,12 @@ public function testWrapResolverWithProxyMatchReplaceStrategyOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied'));
$proxiedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.proxied');
- $this->assertInstanceOf(DefinitionDecorator::class, $proxiedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $proxiedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.aws_s3', $proxiedResolverDefinition->getParent());
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name.cached'));
$cachedResolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name.cached');
- $this->assertInstanceOf(DefinitionDecorator::class, $cachedResolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $cachedResolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.proxy', $cachedResolverDefinition->getParent());
$this->assertInstanceOf(Reference::class, $cachedResolverDefinition->getArgument(0));
diff --git a/Tests/DependencyInjection/Factory/Resolver/FlysystemResolverFactoryTest.php b/Tests/DependencyInjection/Factory/Resolver/FlysystemResolverFactoryTest.php
index 888c2ca72..b923b9030 100644
--- a/Tests/DependencyInjection/Factory/Resolver/FlysystemResolverFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Resolver/FlysystemResolverFactoryTest.php
@@ -17,12 +17,12 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\ChildDefinition;
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Factory\Resolver\FlysystemResolverFactory
*/
-class FlysystemResolverFactoryTest extends \Phpunit_Framework_TestCase
+class FlysystemResolverFactoryTest extends \PHPUnit\Framework\TestCase
{
public function setUp()
{
@@ -42,7 +42,9 @@ public function testImplementsResolverFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new FlysystemResolverFactory();
+ $loader = new FlysystemResolverFactory();
+
+ $this->assertInstanceOf(FlysystemResolverFactory::class, $loader);
}
public function testReturnExpectedName()
@@ -68,7 +70,7 @@ public function testCreateResolverDefinitionOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.flysystem', $resolverDefinition->getParent());
$this->assertEquals('http://images.example.com', $resolverDefinition->getArgument(2));
diff --git a/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php b/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php
index 09dd23634..15931169e 100644
--- a/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php
+++ b/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php
@@ -16,12 +16,12 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\DefinitionDecorator;
+use Symfony\Component\DependencyInjection\ChildDefinition;
/**
* @covers \Liip\ImagineBundle\DependencyInjection\Factory\Resolver\WebPathResolverFactory
*/
-class WebPathResolverFactoryTest extends \Phpunit_Framework_TestCase
+class WebPathResolverFactoryTest extends \PHPUnit\Framework\TestCase
{
public function testImplementsResolverFactoryInterface()
{
@@ -32,7 +32,9 @@ public function testImplementsResolverFactoryInterface()
public function testCouldBeConstructedWithoutAnyArguments()
{
- new WebPathResolverFactory();
+ $loader = new WebPathResolverFactory();
+
+ $this->assertInstanceOf(WebPathResolverFactory::class, $loader);
}
public function testReturnExpectedName()
@@ -56,7 +58,7 @@ public function testCreateResolverDefinitionOnCreate()
$this->assertTrue($container->hasDefinition('liip_imagine.cache.resolver.the_resolver_name'));
$resolverDefinition = $container->getDefinition('liip_imagine.cache.resolver.the_resolver_name');
- $this->assertInstanceOf(DefinitionDecorator::class, $resolverDefinition);
+ $this->assertInstanceOf(ChildDefinition::class, $resolverDefinition);
$this->assertEquals('liip_imagine.cache.resolver.prototype.web_path', $resolverDefinition->getParent());
$this->assertEquals('theWebRoot', $resolverDefinition->getArgument(2));
diff --git a/Tests/Events/CacheResolveEventTest.php b/Tests/Events/CacheResolveEventTest.php
index 4a77d2966..89f683e5c 100644
--- a/Tests/Events/CacheResolveEventTest.php
+++ b/Tests/Events/CacheResolveEventTest.php
@@ -16,7 +16,7 @@
/**
* @covers \Liip\ImagineBundle\Events\CacheResolveEvent
*/
-class CacheResolveEventTest extends \PHPUnit_Framework_TestCase
+class CacheResolveEventTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
diff --git a/Tests/Exception/Imagine/Cache/Resolver/NotResolvableExceptionTest.php b/Tests/Exception/Imagine/Cache/Resolver/NotResolvableExceptionTest.php
index 9c51a4127..2d1bd1f90 100644
--- a/Tests/Exception/Imagine/Cache/Resolver/NotResolvableExceptionTest.php
+++ b/Tests/Exception/Imagine/Cache/Resolver/NotResolvableExceptionTest.php
@@ -17,7 +17,7 @@
/**
* @covers \Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotResolvableException
*/
-class NotResolvableExceptionTest extends \PHPUnit_Framework_TestCase
+class NotResolvableExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testSubClassOfRuntimeException()
{
diff --git a/Tests/Exception/Imagine/Cache/Resolver/NotStorableExceptionTest.php b/Tests/Exception/Imagine/Cache/Resolver/NotStorableExceptionTest.php
index 025852dfa..5d58c3c4e 100644
--- a/Tests/Exception/Imagine/Cache/Resolver/NotStorableExceptionTest.php
+++ b/Tests/Exception/Imagine/Cache/Resolver/NotStorableExceptionTest.php
@@ -17,7 +17,7 @@
/**
* @covers \Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotStorableException
*/
-class NotStorableExceptionTest extends \PHPUnit_Framework_TestCase
+class NotStorableExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testSubClassOfRuntimeException()
{
diff --git a/Tests/Functional/Binary/ExtensionGuesserTest.php b/Tests/Functional/Binary/ExtensionGuesserTest.php
deleted file mode 100644
index 9b85e5546..000000000
--- a/Tests/Functional/Binary/ExtensionGuesserTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-createClient();
-
- $this->assertInstanceOf(
- ExtensionGuesser::class,
- self::$kernel->getContainer()->get('liip_imagine.extension_guesser')
- );
- }
-}
diff --git a/Tests/Functional/Binary/MimeTypeGuesserTest.php b/Tests/Functional/Binary/MimeTypeGuesserTest.php
deleted file mode 100644
index e0302c5ac..000000000
--- a/Tests/Functional/Binary/MimeTypeGuesserTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-createClient();
-
- $this->assertInstanceOf(
- MimeTypeGuesser::class,
- self::$kernel->getContainer()->get('liip_imagine.mime_type_guesser')
- );
- }
-}
diff --git a/Tests/Functional/Binary/SimpleMimeTypeGuesserTest.php b/Tests/Functional/Binary/SimpleMimeTypeGuesserTest.php
deleted file mode 100644
index 88ef986f8..000000000
--- a/Tests/Functional/Binary/SimpleMimeTypeGuesserTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-createClient();
-
- $this->assertInstanceOf(
- SimpleMimeTypeGuesser::class,
- self::$kernel->getContainer()->get('liip_imagine.binary.mime_type_guesser')
- );
- }
-}
diff --git a/Tests/Functional/Command/AbstractCommandTestCase.php b/Tests/Functional/Command/AbstractCommandTestCase.php
index c620f9df5..3ffc7502a 100644
--- a/Tests/Functional/Command/AbstractCommandTestCase.php
+++ b/Tests/Functional/Command/AbstractCommandTestCase.php
@@ -12,7 +12,6 @@
namespace Liip\ImagineBundle\Tests\Functional\Command;
use Liip\ImagineBundle\Tests\Functional\AbstractSetupWebTestCase;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;
@@ -28,12 +27,6 @@ class AbstractCommandTestCase extends AbstractSetupWebTestCase
*/
protected function executeConsole(Command $command, array $arguments = array(), array $options = array())
{
- $command->setApplication(new Application($this->createClient()->getKernel()));
- if ($command instanceof ContainerAwareCommand) {
- $command->setContainer($this->createClient()->getContainer());
- }
-
- $arguments = array_replace(array('command' => $command->getName()), $arguments);
$options = array_replace(array('--env' => 'test'), $options);
$commandTester = new CommandTester($command);
diff --git a/Tests/Functional/Command/RemoveCacheTest.php b/Tests/Functional/Command/RemoveCacheTest.php
index ccf00bbf0..5b6a96fd0 100644
--- a/Tests/Functional/Command/RemoveCacheTest.php
+++ b/Tests/Functional/Command/RemoveCacheTest.php
@@ -22,7 +22,7 @@ public function testExecuteSuccessfullyWithEmptyCacheAndWithoutParameters()
{
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
- $this->executeConsole(new RemoveCacheCommand());
+ $this->executeConsole($this->getService('liip_imagine.command.remove_cache_command'));
}
public function testExecuteSuccessfullyWithEmptyCacheAndOnePathAndOneFilter()
@@ -30,7 +30,7 @@ public function testExecuteSuccessfullyWithEmptyCacheAndOnePathAndOneFilter()
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array(
'paths' => array('images/cats.jpeg'),
'--filters' => array('thumbnail_web_path'),
@@ -42,7 +42,7 @@ public function testExecuteSuccessfullyWithEmptyCacheAndMultiplePaths()
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('paths' => array('images/cats.jpeg', 'images/cats2.jpeg'))
);
}
@@ -52,7 +52,7 @@ public function testExecuteSuccessfullyWithEmptyCacheAndMultipleFilters()
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('--filters' => array('thumbnail_web_path', 'thumbnail_default'))
);
}
@@ -72,7 +72,7 @@ public function testShouldRemoveAllCacheIfParametersDoesNotPassed()
'anImageContent'
);
- $this->executeConsole(new RemoveCacheCommand());
+ $this->executeConsole($this->getService('liip_imagine.command.remove_cache_command'));
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats2.jpeg');
@@ -99,7 +99,7 @@ public function testShouldRemoveCacheBySinglePath()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('paths' => array('images/cats.jpeg'))
);
@@ -129,7 +129,7 @@ public function testShouldRemoveCacheByMultiplePaths()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('paths' => array('images/cats.jpeg', 'images/cats2.jpeg'))
);
@@ -159,7 +159,7 @@ public function testShouldRemoveCacheBySingleFilter()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('--filters' => array('thumbnail_default'))
);
@@ -189,7 +189,7 @@ public function testShouldRemoveCacheByMultipleFilters()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array('--filters' => array('thumbnail_default', 'thumbnail_web_path'))
);
@@ -215,7 +215,7 @@ public function testShouldRemoveCacheByOnePathAndMultipleFilters()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array(
'paths' => array('images/cats.jpeg'),
'--filters' => array('thumbnail_default', 'thumbnail_web_path'), )
@@ -242,7 +242,7 @@ public function testShouldRemoveCacheByMultiplePathsAndSingleFilter()
);
$this->executeConsole(
- new RemoveCacheCommand(),
+ $this->getService('liip_imagine.command.remove_cache_command'),
array(
'paths' => array('images/cats.jpeg', 'images/cats2.jpeg'),
'--filters' => array('thumbnail_web_path'), )
diff --git a/Tests/Functional/Command/ResolveCacheTest.php b/Tests/Functional/Command/ResolveCacheTest.php
index b0437e002..84e27f655 100644
--- a/Tests/Functional/Command/ResolveCacheTest.php
+++ b/Tests/Functional/Command/ResolveCacheTest.php
@@ -23,7 +23,7 @@ public function testShouldResolveWithEmptyCache()
$this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg');
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array(
'paths' => array('images/cats.jpeg'),
'--filters' => array('thumbnail_web_path'), )
@@ -42,7 +42,7 @@ public function testShouldResolveWithCacheExists()
);
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array(
'paths' => array('images/cats.jpeg'),
'--filters' => array('thumbnail_web_path'), )
@@ -56,7 +56,7 @@ public function testShouldResolveWithCacheExists()
public function testShouldResolveWithFewPathsAndSingleFilter()
{
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array(
'paths' => array('images/cats.jpeg', 'images/cats2.jpeg'),
'--filters' => array('thumbnail_web_path'), )
@@ -76,7 +76,7 @@ public function testShouldResolveWithFewPathsSingleFilterAndPartiallyFullCache()
);
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array(
'paths' => array('images/cats.jpeg', 'images/cats2.jpeg'),
'--filters' => array('thumbnail_web_path'), )
@@ -92,7 +92,7 @@ public function testShouldResolveWithFewPathsSingleFilterAndPartiallyFullCache()
public function testShouldResolveWithFewPathsAndFewFilters()
{
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array(
'paths' => array('images/cats.jpeg', 'images/cats2.jpeg'),
'--filters' => array('thumbnail_web_path', 'thumbnail_default'), )
@@ -107,7 +107,7 @@ public function testShouldResolveWithFewPathsAndFewFilters()
public function testShouldResolveWithFewPathsAndWithoutFilters()
{
$output = $this->executeConsole(
- new ResolveCacheCommand(),
+ $this->getService('liip_imagine.command.resolve_cache_command'),
array('paths' => array('images/cats.jpeg', 'images/cats2.jpeg'))
);
diff --git a/Tests/Functional/app/config/config.yml b/Tests/Functional/app/config/config.yml
index 125be17a4..b287af0d0 100644
--- a/Tests/Functional/app/config/config.yml
+++ b/Tests/Functional/app/config/config.yml
@@ -1,10 +1,12 @@
----
-
parameters:
locale: en
secret: ThisTokenIsNotSoSecretChangeIt
+services:
+ logger:
+ class: "\\Psr\\Log\\NullLogger"
+
framework:
secret: "%secret%"
@@ -75,5 +77,3 @@ liip_imagine:
thumbnail_default:
filters:
thumbnail: { size: [223, 223], mode: inset }
-
-...
diff --git a/Tests/Functional/app/config/routing.yml b/Tests/Functional/app/config/routing.yml
index cfd7408f3..51cce0169 100644
--- a/Tests/Functional/app/config/routing.yml
+++ b/Tests/Functional/app/config/routing.yml
@@ -1,6 +1,2 @@
----
-
_liip_imagine:
- resource: "@LiipImagineBundle/Resources/config/routing.yaml"
-
-...
+ resource: "@LiipImagineBundle/Resources/config/routing.yaml"
\ No newline at end of file
diff --git a/Tests/Imagine/Cache/Resolver/NoCacheWebPathResolverTest.php b/Tests/Imagine/Cache/Resolver/NoCacheWebPathResolverTest.php
index 0da5e14a8..02dbffb44 100644
--- a/Tests/Imagine/Cache/Resolver/NoCacheWebPathResolverTest.php
+++ b/Tests/Imagine/Cache/Resolver/NoCacheWebPathResolverTest.php
@@ -23,7 +23,9 @@ class NoCacheWebPathResolverTest extends AbstractTest
{
public function testCouldBeConstructedWithRequestContextAsArgument()
{
- new NoCacheWebPathResolver(new RequestContext());
+ $resolver = new NoCacheWebPathResolver(new RequestContext());
+
+ $this->assertInstanceOf(NoCacheWebPathResolver::class, $resolver);
}
public function testComposeSchemaHostAndPathOnResolve()
@@ -44,17 +46,23 @@ public function testDoNothingForPathAndFilterOnRemove()
{
$resolver = new NoCacheWebPathResolver(new RequestContext());
$resolver->remove(array('a/path'), array('aFilter'));
+
+ $this->assertInstanceOf(NoCacheWebPathResolver::class, $resolver);
}
public function testDoNothingForSomePathsAndSomeFiltersOnRemove()
{
$resolver = new NoCacheWebPathResolver(new RequestContext());
$resolver->remove(array('foo', 'bar'), array('foo', 'bar'));
+
+ $this->assertInstanceOf(NoCacheWebPathResolver::class, $resolver);
}
public function testDoNothingForEmptyPathAndEmptyFilterOnRemove()
{
$resolver = new NoCacheWebPathResolver(new RequestContext());
$resolver->remove(array(), array());
+
+ $this->assertInstanceOf(NoCacheWebPathResolver::class, $resolver);
}
}
diff --git a/Tests/Imagine/Cache/Resolver/WebPathResolverTest.php b/Tests/Imagine/Cache/Resolver/WebPathResolverTest.php
index 5f4b205c9..0adf7a001 100644
--- a/Tests/Imagine/Cache/Resolver/WebPathResolverTest.php
+++ b/Tests/Imagine/Cache/Resolver/WebPathResolverTest.php
@@ -20,7 +20,7 @@
/**
* @covers \Liip\ImagineBundle\Imagine\Cache\Resolver\WebPathResolver
*/
-class WebPathResolverTest extends \PHPUnit_Framework_TestCase
+class WebPathResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Filesystem
diff --git a/Tests/Imagine/Cache/SignerTest.php b/Tests/Imagine/Cache/SignerTest.php
index 92fbc16b6..b266604a5 100644
--- a/Tests/Imagine/Cache/SignerTest.php
+++ b/Tests/Imagine/Cache/SignerTest.php
@@ -29,7 +29,9 @@ public function testImplementsSignerInterface()
public function testCouldBeConstructedWithSecret()
{
- new Signer('aSecret');
+ $signer = new Signer('aSecret');
+
+ $this->assertInstanceOf(Signer::class, $signer);
}
public function testShouldReturnShortHashOnSign()
diff --git a/Tests/Imagine/Filter/Loader/DownscaleFilterLoaderTest.php b/Tests/Imagine/Filter/Loader/DownscaleFilterLoaderTest.php
index 99158d03d..324f9ef8b 100644
--- a/Tests/Imagine/Filter/Loader/DownscaleFilterLoaderTest.php
+++ b/Tests/Imagine/Filter/Loader/DownscaleFilterLoaderTest.php
@@ -22,7 +22,7 @@
*/
class DownscaleFilterLoaderTest extends AbstractTest
{
- public function testItWorksSomeHow()
+ public function downscale()
{
$loader = new DownscaleFilterLoader();
@@ -45,7 +45,7 @@ public function testItWorksSomeHow()
}
/**
- * @depends testItWorksSomeHow
+ * @depends downscale
*/
public function testDontScaleUp($sizes)
{
@@ -55,7 +55,7 @@ public function testDontScaleUp($sizes)
}
/**
- * @depends testItWorksSomeHow
+ * @depends downscale
*/
public function testFitBoundingBox($sizes)
{
diff --git a/Tests/Model/BinaryTest.php b/Tests/Model/BinaryTest.php
index 450fcf158..efe5affa4 100644
--- a/Tests/Model/BinaryTest.php
+++ b/Tests/Model/BinaryTest.php
@@ -16,7 +16,7 @@
/**
* @covers \Liip\ImagineBundle\Model\Binary
*/
-class BinaryTest extends \PHPUnit_Framework_TestCase
+class BinaryTest extends \PHPUnit\Framework\TestCase
{
public function testImplementsBinaryInterface()
{
diff --git a/Tests/Templating/FilterExtensionTest.php b/Tests/Templating/FilterExtensionTest.php
index 3abac1eef..c04e90cad 100644
--- a/Tests/Templating/FilterExtensionTest.php
+++ b/Tests/Templating/FilterExtensionTest.php
@@ -37,6 +37,10 @@ public function testInstanceOfTwigFilter()
*/
protected function createTemplatingMock(CacheManager $manager = null)
{
- return new FilterExtension($manager ?: $this->createCacheManagerMock());
+ $mock = new FilterExtension($manager ?: $this->createCacheManagerMock());
+
+ $this->assertInstanceOf(FilterExtension::class, $mock);
+
+ return $mock;
}
}
diff --git a/Tests/Templating/Helper/FilterHelperTest.php b/Tests/Templating/Helper/FilterHelperTest.php
index f4b7c6730..0cb26b9f2 100644
--- a/Tests/Templating/Helper/FilterHelperTest.php
+++ b/Tests/Templating/Helper/FilterHelperTest.php
@@ -34,6 +34,10 @@ public function testInstanceOfSymfonyHelper()
*/
protected function createTemplatingMock(CacheManager $manager = null)
{
- return new FilterHelper($manager ?: $this->createCacheManagerMock());
+ $mock = new FilterHelper($manager ?: $this->createCacheManagerMock());
+
+ $this->assertInstanceOf(FilterHelper::class, $mock);
+
+ return $mock;
}
}
diff --git a/Tests/Utility/Framework/SymfonyFrameworkTest.php b/Tests/Utility/Framework/SymfonyFrameworkTest.php
index 7214f9450..402f67ed0 100644
--- a/Tests/Utility/Framework/SymfonyFrameworkTest.php
+++ b/Tests/Utility/Framework/SymfonyFrameworkTest.php
@@ -16,7 +16,7 @@
/**
* @covers \Liip\ImagineBundle\Utility\Framework\SymfonyFramework
*/
-class SymfonyFrameworkTest extends \PHPUnit_Framework_TestCase
+class SymfonyFrameworkTest extends \PHPUnit\Framework\TestCase
{
public function testKernelComparisonForCurrentKernel()
{
diff --git a/composer.json b/composer.json
index 667ca4f94..c41fe2587 100644
--- a/composer.json
+++ b/composer.json
@@ -18,37 +18,37 @@
"exclude-from-classmap": [ "/Tests/" ]
},
"require": {
- "php": "~7.1",
+ "php": "^7.1",
"imagine/Imagine": "^0.6.3,<0.7",
- "symfony/asset": "~3.0|^4.0",
- "symfony/filesystem": "~3.0|^4.0",
- "symfony/finder": "~3.0|^4.0",
- "symfony/framework-bundle": "~3.0|^4.0",
- "symfony/options-resolver": "~3.0|^4.0",
- "symfony/process": "~3.0|^4.0",
- "symfony/templating": "~3.0|^4.0",
- "symfony/translation": "~3.0|^4.0"
+ "symfony/asset": "^3.0|^4.0",
+ "symfony/filesystem": "^3.0|^4.0",
+ "symfony/finder": "^3.0|^4.0",
+ "symfony/framework-bundle": "^3.0|^4.0",
+ "symfony/options-resolver": "^3.0|^4.0",
+ "symfony/process": "^3.0|^4.0",
+ "symfony/templating": "^3.0|^4.0",
+ "symfony/translation": "^3.0|^4.0"
},
"require-dev": {
"ext-gd": "*",
- "amazonwebservices/aws-sdk-for-php": "~1.0",
- "aws/aws-sdk-php": "~2.4",
- "doctrine/cache": "~1.1",
- "doctrine/orm": "~2.3",
+ "amazonwebservices/aws-sdk-for-php": "^1.0",
+ "aws/aws-sdk-php": "^2.4",
+ "doctrine/cache": "^1.1",
+ "doctrine/orm": "^2.3",
"enqueue/enqueue-bundle": "^0.7|^0.8",
- "friendsofphp/php-cs-fixer": "~1.0|~2.0",
- "league/flysystem": "~1.0",
- "phpunit/phpunit": "~5.0",
- "psr/log": "~1.0",
- "satooshi/php-coveralls": "~1.0",
- "symfony/browser-kit": "~3.0|^4.0",
- "symfony/console": "~3.0|^4.0",
- "symfony/dependency-injection": "~3.0|^4.0",
- "symfony/form": "~3.0|^4.0",
- "symfony/phpunit-bridge": "~3.0|^4.0",
- "symfony/validator": "~3.0|^4.0",
- "symfony/yaml": "~3.0|^4.0",
- "twig/twig": "~1.12|~2.0"
+ "friendsofphp/php-cs-fixer": "^1.0|^2.0",
+ "league/flysystem": "^1.0",
+ "phpunit/phpunit": "^6.0",
+ "psr/log": "^1.0",
+ "satooshi/php-coveralls": "^1.0",
+ "symfony/browser-kit": "^3.0|^4.0",
+ "symfony/console": "^3.0|^4.0",
+ "symfony/dependency-injection": "^3.0|^4.0",
+ "symfony/form": "^3.0|^4.0",
+ "symfony/phpunit-bridge": "^3.0|^4.0",
+ "symfony/validator": "^3.0|^4.0",
+ "symfony/yaml": "^3.0|^4.0",
+ "twig/twig": "^1.12|^2.0"
},
"suggest": {
"ext-exif": "required to read EXIF metadata from images",
@@ -67,8 +67,8 @@
"twig/twig": "required to use the provided Twig extension. Version 1.12 or greater needed"
},
"minimum-stability": "dev",
+ "prefer-stable": true,
"config": {
- "bin-dir": "bin",
"sort-packages": true
},
"extra": {