aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php5
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml2
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php11
3 files changed, 14 insertions, 4 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 72b9047c..0463a739 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -11,6 +11,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Entity\Tag; 12use Wallabag\CoreBundle\Entity\Tag;
13use Wallabag\CoreBundle\Helper\ContentProxy; 13use Wallabag\CoreBundle\Helper\ContentProxy;
14use Craue\ConfigBundle\Util\Config;
14 15
15class PocketImport implements ImportInterface 16class PocketImport implements ImportInterface
16{ 17{
@@ -25,12 +26,12 @@ class PocketImport implements ImportInterface
25 protected $accessToken; 26 protected $accessToken;
26 private $translator; 27 private $translator;
27 28
28 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey) 29 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
29 { 30 {
30 $this->user = $tokenStorage->getToken()->getUser(); 31 $this->user = $tokenStorage->getToken()->getUser();
31 $this->em = $em; 32 $this->em = $em;
32 $this->contentProxy = $contentProxy; 33 $this->contentProxy = $contentProxy;
33 $this->consumerKey = $consumerKey; 34 $this->consumerKey = $craueConfig->get('pocket_consumer_key');
34 $this->logger = new NullLogger(); 35 $this->logger = new NullLogger();
35 } 36 }
36 37
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index e4dde100..dc536808 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -17,7 +17,7 @@ services:
17 - "@security.token_storage" 17 - "@security.token_storage"
18 - "@doctrine.orm.entity_manager" 18 - "@doctrine.orm.entity_manager"
19 - "@wallabag_core.content_proxy" 19 - "@wallabag_core.content_proxy"
20 - %pocket_consumer_key% 20 - "@craue_config"
21 calls: 21 calls:
22 - [ setClient, [ "@wallabag_import.pocket.client" ] ] 22 - [ setClient, [ "@wallabag_import.pocket.client" ] ]
23 - [ setLogger, [ "@logger" ]] 23 - [ setLogger, [ "@logger" ]]
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
index 76225fe4..25359d56 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
@@ -55,11 +55,20 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
55 ->disableOriginalConstructor() 55 ->disableOriginalConstructor()
56 ->getMock(); 56 ->getMock();
57 57
58 $config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
59 ->disableOriginalConstructor()
60 ->getMock();
61
62 $config->expects($this->any())
63 ->method('get')
64 ->with('pocket_consumer_key')
65 ->willReturn($consumerKey);
66
58 $pocket = new PocketImportMock( 67 $pocket = new PocketImportMock(
59 $this->tokenStorage, 68 $this->tokenStorage,
60 $this->em, 69 $this->em,
61 $this->contentProxy, 70 $this->contentProxy,
62 $consumerKey 71 $config
63 ); 72 );
64 73
65 $this->logHandler = new TestHandler(); 74 $this->logHandler = new TestHandler();