Skip to content

Commit

Permalink
Merge branch 'jean-gui-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilkybarkid committed Aug 22, 2016
2 parents ddce0d8 + 1e9bcf6 commit 21e4f76
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion Tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ protected function getContainer(array $config = array(), KernelInterface $kernel
$container->setParameter('kernel.cache_dir', sys_get_temp_dir() . '/linkify');
$container->setParameter('kernel.bundles', array());
$container->setParameter('kernel.root_dir', __DIR__ . '/Fixtures');
$container->set('service_container', $container);

$container->registerExtension($extension);
$extension->load($config, $container);
Expand Down
8 changes: 6 additions & 2 deletions Tests/Twig/Extension/LinkifyTwigExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Misd\LinkifyBundle\Tests\AbstractTestCase;
use Misd\LinkifyBundle\Twig\Extension\LinkifyTwigExtension;
use Twig_SimpleFilter;

class LinkifyTwigExtensionTest extends AbstractTestCase
{
Expand All @@ -36,8 +37,11 @@ public function testFilters()

$filters = $extension->getFilters();

$this->assertArrayHasKey('linkify', $filters);
$this->assertInstanceOf('Twig_Filter_Method', $filters['linkify']);
$linkifyFilters = array_filter($filters, function (Twig_SimpleFilter $filter) {
return $filter->getName() === 'linkify';
});

$this->assertCount(1, $linkifyFilters);
}

public function testLinkify()
Expand Down
4 changes: 2 additions & 2 deletions Twig/Extension/LinkifyTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Misd\LinkifyBundle\Twig\Extension;

use Twig_Extension;
use Twig_Filter_Method;
use Twig_SimpleFilter;
use Misd\LinkifyBundle\Helper\LinkifyHelper;

/**
Expand Down Expand Up @@ -41,7 +41,7 @@ public function __construct(LinkifyHelper $helper)
public function getFilters()
{
return array(
'linkify' => new Twig_Filter_Method($this, 'linkify', array(
new Twig_SimpleFilter('linkify', array($this, 'linkify'), array(
'pre_escape' => 'html',
'is_safe' => array('html')
)),
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/framework-bundle": "^2.1",
"symfony/framework-bundle": "^2.1 || ^3.0",
"misd/linkify": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0",
"symfony/twig-bundle": "^2.1"
"symfony/twig-bundle": "^2.1 || ^3.0"
},
"conflict": {
"phpunit/phpunit-mock-objects": "<2.2"
"phpunit/phpunit-mock-objects": "<2.2",
"twig/twig": "<1.23"
},
"suggest": {
"symfony/twig-bundle": "to use the Twig linkify filter"
Expand Down

0 comments on commit 21e4f76

Please sign in to comment.