From a09f4c2214e26fcb08e044770cf90aa0e78fe2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20JOURDIN?= Date: Tue, 29 Jul 2014 22:04:11 +0200 Subject: [PATCH 1/2] Update WebPathResolverFactory.php --- DependencyInjection/Factory/Resolver/WebPathResolverFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Factory/Resolver/WebPathResolverFactory.php b/DependencyInjection/Factory/Resolver/WebPathResolverFactory.php index 550189a08..a50028ab2 100644 --- a/DependencyInjection/Factory/Resolver/WebPathResolverFactory.php +++ b/DependencyInjection/Factory/Resolver/WebPathResolverFactory.php @@ -42,7 +42,7 @@ public function addConfiguration(ArrayNodeDefinition $builder) $builder ->children() ->scalarNode('web_root')->defaultValue('%kernel.root_dir%/../web')->cannotBeEmpty()->end() - ->scalarNode('cache_prefix')->defaultValue('media/cache/resolve')->cannotBeEmpty()->end() + ->scalarNode('cache_prefix')->defaultValue('media/cache')->cannotBeEmpty()->end() ->end() ; } From 9a9e4af64aa1893d7381d01054e4a0339a8d2ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Jourdin?= Date: Wed, 30 Jul 2014 16:06:30 +0200 Subject: [PATCH 2/2] Fix /media/cache/resolve route --- Resources/config/routing.xml | 4 ++-- .../Factory/Resolver/WebPathResolverFactoryTest.php | 2 +- .../Functional/Controller/ImagineControllerTest.php | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Resources/config/routing.xml b/Resources/config/routing.xml index 62f242b17..ed1f2fc29 100644 --- a/Resources/config/routing.xml +++ b/Resources/config/routing.xml @@ -5,13 +5,13 @@ xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + %liip_imagine.controller.filter_runtime_action% [A-z0-9_\-]* .+ - + %liip_imagine.controller.filter_action% [A-z0-9_\-]* .+ diff --git a/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php b/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php index 6d1d0b48b..3eafdf638 100644 --- a/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php +++ b/Tests/DependencyInjection/Factory/Resolver/WebPathResolverFactoryTest.php @@ -92,7 +92,7 @@ public function testAddDefaultOptionsIfNotSetOnAddConfiguration() $this->assertEquals('%kernel.root_dir%/../web', $config['web_root']); $this->assertArrayHasKey('cache_prefix', $config); - $this->assertEquals('media/cache/resolve', $config['cache_prefix']); + $this->assertEquals('media/cache', $config['cache_prefix']); } /** diff --git a/Tests/Functional/Controller/ImagineControllerTest.php b/Tests/Functional/Controller/ImagineControllerTest.php index aff8abba4..5bfa8112b 100644 --- a/Tests/Functional/Controller/ImagineControllerTest.php +++ b/Tests/Functional/Controller/ImagineControllerTest.php @@ -50,7 +50,7 @@ public function testShouldResolvePopulatingCacheFirst() //guard $this->assertFileNotExists($this->cacheRoot.'/thumbnail_web_path/images/cats.jpeg'); - $this->client->request('GET', '/media/cache/thumbnail_web_path/images/cats.jpeg'); + $this->client->request('GET', '/media/cache/resolve/thumbnail_web_path/images/cats.jpeg'); $response = $this->client->getResponse(); @@ -68,7 +68,7 @@ public function testShouldResolveFromCache() 'anImageContent' ); - $this->client->request('GET', '/media/cache/thumbnail_web_path/images/cats.jpeg'); + $this->client->request('GET', '/media/cache/resolve/thumbnail_web_path/images/cats.jpeg'); $response = $this->client->getResponse(); @@ -85,7 +85,7 @@ public function testShouldResolveFromCache() */ public function testThrowBadRequestIfSignInvalidWhileUsingCustomFilters() { - $this->client->request('GET', '/media/cache/thumbnail_web_path/rc/invalidHash/images/cats.jpeg?'.http_build_query(array( + $this->client->request('GET', '/media/cache/resolve/thumbnail_web_path/rc/invalidHash/images/cats.jpeg?'.http_build_query(array( 'filters' => array( 'thumbnail' => array('size' => array(50, 50)) ), @@ -99,7 +99,7 @@ public function testThrowBadRequestIfSignInvalidWhileUsingCustomFilters() */ public function testShouldThrowNotFoundHttpExceptionIfFileNotExists() { - $this->client->request('GET', '/media/cache/thumbnail_web_path/images/shrodinger_cats_which_not_exist.jpeg'); + $this->client->request('GET', '/media/cache/resolve/thumbnail_web_path/images/shrodinger_cats_which_not_exist.jpeg'); } public function testShouldResolveWithCustomFiltersPopulatingCacheFirst() @@ -119,7 +119,7 @@ public function testShouldResolveWithCustomFiltersPopulatingCacheFirst() $expectedCachePath = 'thumbnail_web_path/rc/'.$hash.'/'.$path; - $url = 'http://localhost/media/cache/'.$expectedCachePath.'?'.http_build_query($params); + $url = 'http://localhost/media/cache/resolve/'.$expectedCachePath.'?'.http_build_query($params); //guard $this->assertFileNotExists($this->cacheRoot.'/'.$expectedCachePath); @@ -152,7 +152,7 @@ public function testShouldResolveWithCustomFiltersFromCache() $expectedCachePath = 'thumbnail_web_path/rc/'.$hash.'/'.$path; - $url = 'http://localhost/media/cache/'.$expectedCachePath.'?'.http_build_query($params); + $url = 'http://localhost/media/cache/resolve/'.$expectedCachePath.'?'.http_build_query($params); $this->filesystem->dumpFile( $this->cacheRoot.'/'.$expectedCachePath,