Skip to content

Commit

Permalink
Merge pull request #467 from JJK801/patch-1
Browse files Browse the repository at this point in the history
Update WebPathResolverFactory.php
  • Loading branch information
makasim committed Jul 30, 2014
2 parents a1b8047 + 9a9e4af commit a85ef19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
;
}
Expand Down
4 changes: 2 additions & 2 deletions Resources/config/routing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="liip_imagine_filter_runtime" path="/media/cache/{filter}/rc/{hash}/{path}" methods="GET">
<route id="liip_imagine_filter_runtime" path="/media/cache/resolve/{filter}/rc/{hash}/{path}" methods="GET">
<default key="_controller">%liip_imagine.controller.filter_runtime_action%</default>
<requirement key="filter">[A-z0-9_\-]*</requirement>
<requirement key="path">.+</requirement>
</route>

<route id="liip_imagine_filter" path="/media/cache/{filter}/{path}" methods="GET">
<route id="liip_imagine_filter" path="/media/cache/resolve/{filter}/{path}" methods="GET">
<default key="_controller">%liip_imagine.controller.filter_action%</default>
<requirement key="filter">[A-z0-9_\-]*</requirement>
<requirement key="path">.+</requirement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions Tests/Functional/Controller/ImagineControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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))
),
Expand All @@ -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()
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a85ef19

Please sign in to comment.