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