diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-06-01 21:27:35 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-06-22 17:59:35 +0200 |
commit | 23634d5d842dabcf5d7475e2becb7e127824239e (patch) | |
tree | b91688722a996c46f27e8fe0542c356424483da3 /tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php | |
parent | 891a026e31ad54ca90b70f6026f23260cfadb7fd (diff) | |
download | wallabag-23634d5d842dabcf5d7475e2becb7e127824239e.tar.gz wallabag-23634d5d842dabcf5d7475e2becb7e127824239e.tar.zst wallabag-23634d5d842dabcf5d7475e2becb7e127824239e.zip |
Jump to Symfony 3.1
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php')
-rw-r--r-- | tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php new file mode 100644 index 00000000..71a007a9 --- /dev/null +++ b/tests/Wallabag/ImportBundle/Import/ImportCompilerPassTest.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Tests\Wallabag\ImportBundle\Import; | ||
4 | |||
5 | use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
6 | use Wallabag\ImportBundle\Import\ImportCompilerPass; | ||
7 | |||
8 | class 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') | ||
28 | ->addTag('wallabag_import.import', ['alias' => 'pocket']) | ||
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 | } | ||