Skip to content

Commit

Permalink
* implement interlace filter
Browse files Browse the repository at this point in the history
* add functional and unit test
* move functional tests (DataManager and FilterManager) to subfolders
  • Loading branch information
wodka authored and wodka committed Jan 8, 2015
1 parent f45d5cc commit 9cf5294
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Imagine/Filter/Loader/InterlaceFilterLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class InterlaceFilterLoader implements LoaderInterface
public function load(ImageInterface $image, array $options = array())
{
$mode = ImageInterface::INTERLACE_LINE;
if (empty($options['mode']) {
if (!empty($options['mode'])) {
$mode = $options['mode'];
}

$image->interlace(ImageInterface::INTERLACE_LINE);
$image->interlace($mode);

return $image;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Liip\ImagineBundle\Tests\Functional\Imagine;
namespace Liip\ImagineBundle\Tests\Functional\Imagine\Data;

use Liip\ImagineBundle\Tests\Functional\WebTestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace Liip\ImagineBundle\Tests\Functional\Imagine;
namespace Liip\ImagineBundle\Tests\Functional\Imagine\Filter;

use Liip\ImagineBundle\Tests\Functional\WebTestCase;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
namespace Liip\ImagineBundle\Tests\Functional\Imagine\Filter\Loader;

use Liip\ImagineBundle\Tests\Functional\WebTestCase;

class InterlaceFilterLoaderTest extends WebTestCase
{
public function testCouldBeGetFromContainerAsService()
{
$this->createClient();
$service = self::$kernel->getContainer()->get('liip_imagine.filter.loader.interlace');

$this->assertInstanceOf('Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader', $service);
}
}

28 changes: 28 additions & 0 deletions Tests/Imagine/Filter/Loader/InterlaceFilterLoaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Liip\ImagineBundle\Tests\Filter;

use Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader;
use Liip\ImagineBundle\Tests\AbstractTest;

/**
* @covers Liip\ImagineBundle\Imagine\Filter\Loader\InterlaceFilterLoader
*/
class InterlaceFilterLoaderTest extends AbstractTest
{
public function testLoad()
{
$loader = new InterlaceFilterLoader();

$image = $this->getMockImage();
$image
->expects($this->once())
->method('interlace')
->with('TEST')
;

$result = $loader->load($image, array('mode' => 'TEST'));

$this->assertInstanceOf('Imagine\Image\ImageInterface', $result);
}
}

0 comments on commit 9cf5294

Please sign in to comment.