diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-31 11:24:46 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-02 23:27:41 +0100 |
commit | 7019c7cf6c6af39c0f458769e20c3f9306477943 (patch) | |
tree | 12acceaa458cdf6d24367eba85f690265acddcdb /src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php | |
parent | b1d05721cf37ab94ec1a6837fe79cf19474dd0ff (diff) | |
download | wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.gz wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.zst wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.zip |
Add tagged services for import
- list services in /import
- add url to import service
- ImportBundle routing are now prefixed by /import
- optimize flush in each import (flushing each 20 contents)
- improve design of each import
- add more tests
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php b/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php new file mode 100644 index 00000000..bd62ab3b --- /dev/null +++ b/src/Wallabag/ImportBundle/Tests/Import/ImportCompilerPassTest.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Tests\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', array('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 | } | ||