3 namespace Tests\Wallabag\ImportBundle\Import
;
5 use PHPUnit\Framework\TestCase
;
6 use Symfony\Component\DependencyInjection\ContainerBuilder
;
7 use Wallabag\ImportBundle\Import\ImportCompilerPass
;
9 class ImportCompilerPassTest
extends TestCase
11 public function testProcessNoDefinition()
13 $container = new ContainerBuilder();
14 $res = $this->process($container);
16 $this->assertNull($res);
19 public function testProcess()
21 $container = new ContainerBuilder();
23 ->register('wallabag_import.chain')
29 ->addTag('wallabag_import.import', ['alias' => 'pocket'])
32 $this->process($container);
34 $this->assertTrue($container->hasDefinition('wallabag_import.chain'));
36 $definition = $container->getDefinition('wallabag_import.chain');
37 $this->assertTrue($definition->hasMethodCall('addImport'));
39 $calls = $definition->getMethodCalls();
40 $this->assertSame('pocket', $calls[0][1][1]);
43 protected function process(ContainerBuilder
$container)
45 $repeatedPass = new ImportCompilerPass();
46 $repeatedPass->process($container);