]> git.immae.eu Git - github/wallabag/wallabag.git/blame - tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php
Merge pull request #3959 from wallabag/mig-tag-collation
[github/wallabag/wallabag.git] / tests / Wallabag / ImportBundle / Import / ImportCompilerPassTest.php
CommitLineData
7019c7cf
JB
1<?php
2
23634d5d 3namespace Tests\Wallabag\ImportBundle\Import;
7019c7cf 4
bd91bd5c 5use PHPUnit\Framework\TestCase;
7019c7cf
JB
6use Symfony\Component\DependencyInjection\ContainerBuilder;
7use Wallabag\ImportBundle\Import\ImportCompilerPass;
8
bd91bd5c 9class ImportCompilerPassTest extends TestCase
7019c7cf
JB
10{
11 public function testProcessNoDefinition()
12 {
13 $container = new ContainerBuilder();
14 $res = $this->process($container);
15
16 $this->assertNull($res);
17 }
18
19 public function testProcess()
20 {
21 $container = new ContainerBuilder();
22 $container
23 ->register('wallabag_import.chain')
24 ->setPublic(false)
25 ;
26
27 $container
28 ->register('foo')
4094ea47 29 ->addTag('wallabag_import.import', ['alias' => 'pocket'])
7019c7cf
JB
30 ;
31
32 $this->process($container);
33
34 $this->assertTrue($container->hasDefinition('wallabag_import.chain'));
35
36 $definition = $container->getDefinition('wallabag_import.chain');
37 $this->assertTrue($definition->hasMethodCall('addImport'));
38
39 $calls = $definition->getMethodCalls();
f808b016 40 $this->assertSame('pocket', $calls[0][1][1]);
7019c7cf
JB
41 }
42
43 protected function process(ContainerBuilder $container)
44 {
45 $repeatedPass = new ImportCompilerPass();
46 $repeatedPass->process($container);
47 }
48}