3 namespace Tests\Wallabag\ImportBundle\Import
;
5 use Symfony\Component\DependencyInjection\ContainerBuilder
;
6 use Wallabag\ImportBundle\Import\ImportCompilerPass
;
8 class ImportCompilerPassTest
extends \PHPUnit_Framework_TestCase
10 public function testProcessNoDefinition()
12 $container = new ContainerBuilder();
13 $res = $this->process($container);
15 $this->assertNull($res);
18 public function testProcess()
20 $container = new ContainerBuilder();
22 ->register('wallabag_import.chain')
28 ->addTag('wallabag_import.import', ['alias' => 'pocket'])
31 $this->process($container);
33 $this->assertTrue($container->hasDefinition('wallabag_import.chain'));
35 $definition = $container->getDefinition('wallabag_import.chain');
36 $this->assertTrue($definition->hasMethodCall('addImport'));
38 $calls = $definition->getMethodCalls();
39 $this->assertEquals('pocket', $calls[0][1][1]);
42 protected function process(ContainerBuilder
$container)
44 $repeatedPass = new ImportCompilerPass();
45 $repeatedPass->process($container);