forked from wallabag/wallabag
Add CraueConfig for internal settings
This commit is contained in:
@ -11,6 +11,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||
use Craue\ConfigBundle\Util\Config;
|
||||
|
||||
class PocketImport implements ImportInterface
|
||||
{
|
||||
@ -25,12 +26,12 @@ class PocketImport implements ImportInterface
|
||||
protected $accessToken;
|
||||
private $translator;
|
||||
|
||||
public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey)
|
||||
public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
|
||||
{
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->em = $em;
|
||||
$this->contentProxy = $contentProxy;
|
||||
$this->consumerKey = $consumerKey;
|
||||
$this->consumerKey = $craueConfig->get('pocket_consumer_key');
|
||||
$this->logger = new NullLogger();
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ services:
|
||||
- "@security.token_storage"
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@wallabag_core.content_proxy"
|
||||
- %pocket_consumer_key%
|
||||
- "@craue_config"
|
||||
calls:
|
||||
- [ setClient, [ "@wallabag_import.pocket.client" ] ]
|
||||
- [ setLogger, [ "@logger" ]]
|
||||
|
||||
@ -55,11 +55,20 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$config->expects($this->any())
|
||||
->method('get')
|
||||
->with('pocket_consumer_key')
|
||||
->willReturn($consumerKey);
|
||||
|
||||
$pocket = new PocketImportMock(
|
||||
$this->tokenStorage,
|
||||
$this->em,
|
||||
$this->contentProxy,
|
||||
$consumerKey
|
||||
$config
|
||||
);
|
||||
|
||||
$this->logHandler = new TestHandler();
|
||||
|
||||
Reference in New Issue
Block a user