Skip to content

Commit eacdae2

Browse files
committed
Merge pull request #526 from lolautruche/patch-1
Fix crash when no post processor is defined
2 parents c8b6eca + f0b5d9b commit eacdae2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Imagine/Filter/FilterManager.php

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function apply(BinaryInterface $binary, array $config)
141141
*/
142142
public function applyPostProcessors(BinaryInterface $binary, $config)
143143
{
144+
$config += array('post_processors' => array());
144145
foreach ($config['post_processors'] as $postProcessorName => $postProcessorOptions) {
145146
if (!isset($this->postProcessors[$postProcessorName])) {
146147
throw new \InvalidArgumentException(sprintf(

Tests/Imagine/Filter/FilterManagerTest.php

+12
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,18 @@ public function testThrowsIfNoPostProcessorAddedForFilterOnApplyFilter()
10981098
$filterManager->applyFilter($binary, 'thumbnail');
10991099
}
11001100

1101+
public function testApplyPostProcessorsWhenNotDefined()
1102+
{
1103+
$binary = $this->getMock('Liip\ImagineBundle\Binary\BinaryInterface');
1104+
$filterManager = new FilterManager(
1105+
$this->createFilterConfigurationMock(),
1106+
$this->createImagineMock(),
1107+
$this->getMockMimeTypeGuesser()
1108+
);
1109+
1110+
$this->assertSame($binary, $filterManager->applyPostProcessors($binary, array()));
1111+
}
1112+
11011113
/**
11021114
* @return \PHPUnit_Framework_MockObject_MockObject|LoaderInterface
11031115
*/

0 commit comments

Comments
 (0)