Skip to content

Commit

Permalink
Add config test and readme doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sveriger committed Feb 8, 2013
1 parent 59cf07b commit c3184c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ liip_imagine:
cache: ~
data_loader: ~
controller_action: ~
route: []
filters:
# Prototype
Expand Down Expand Up @@ -250,6 +251,10 @@ Each filter set that you specify has the following options:
- `cache` - override the default cache setting
- `data_loader` - override the default data loader
- `controller_action` - override the default controller action
- `route` - optional list of route requirements, defaults and options using in the route loader. Add array width keys 'requirements', 'defaults' or 'options'.

default: empty array

- `format` - hardcodes the output format (aka the requested format is ignored)

## Built-in Filters
Expand Down
17 changes: 15 additions & 2 deletions Tests/DependencyInjection/LiipImagineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,18 @@ public function testCacheClearerIsNotRegistered()

$this->assertFalse($this->containerBuilder->hasDefinition('liip_imagine.cache.clearer'));
}


public function testCustomRouteRequirements()
{
$this->createFullConfiguration();
$param = $this->containerBuilder->getParameter('liip_imagine.filter_sets');

$this->assertTrue(isset($param['small']['filters']['route']['requirements']));

$variable1 = $param['small']['filters']['route']['requirements']['variable1'];
$this->assertEquals('value1', $variable1, sprintf('%s parameter is correct', $variable1));
}

/**
* @return ContainerBuilder
*/
Expand All @@ -80,7 +91,7 @@ protected function createEmptyConfiguration()
$loader->load(array(array()), $this->containerBuilder);
$this->assertTrue($this->containerBuilder instanceof ContainerBuilder);
}

/**
* @return ContainerBuilder
*/
Expand All @@ -105,6 +116,8 @@ protected function getFullConfig()
small:
filters:
thumbnail: { size: [100, ~], mode: inset }
route:
requirements: { variable1: 'value1' }
quality: 80
medium_small_cropped:
filters:
Expand Down

0 comments on commit c3184c8

Please sign in to comment.