Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WebPathResolverFactory.php #467

Merged
merged 3 commits into from
Jul 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not ok, as after this change we would again have problems with Safari

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see, igonre the comment

->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