aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-03 17:36:57 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-11 21:57:46 +0200
commitef75e1220ebb76a8df019d946460ad612759f0bb (patch)
tree100830464851d6834e1e24ccabca1961a862fcd8 /tests/Wallabag
parent87c9995b6c61a9f5cde3771bd4f9d44b5da26c43 (diff)
downloadwallabag-ef75e1220ebb76a8df019d946460ad612759f0bb.tar.gz
wallabag-ef75e1220ebb76a8df019d946460ad612759f0bb.tar.zst
wallabag-ef75e1220ebb76a8df019d946460ad612759f0bb.zip
Send every imported item to the queue
Instead of queing real Entry to process, we queue all the item to import from Pocket in a raw format. Then, the worker retrieve that information, find / create the entry and save it.
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ImportBundle/Import/PocketImportTest.php28
1 files changed, 3 insertions, 25 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
index 5bf47d96..d6b9617e 100644
--- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php
@@ -27,32 +27,15 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
27 protected $em; 27 protected $em;
28 protected $contentProxy; 28 protected $contentProxy;
29 protected $logHandler; 29 protected $logHandler;
30 protected $producer;
31 30
32 private function getPocketImport($consumerKey = 'ConsumerKey', $rabbitMQ = false) 31 private function getPocketImport($consumerKey = 'ConsumerKey')
33 { 32 {
34 $this->user = new User(); 33 $this->user = new User();
35 34
36 $this->tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
37 ->disableOriginalConstructor()
38 ->getMock();
39
40 $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')
41 ->disableOriginalConstructor()
42 ->getMock();
43
44 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy') 35 $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
45 ->disableOriginalConstructor() 36 ->disableOriginalConstructor()
46 ->getMock(); 37 ->getMock();
47 38
48 $token->expects($this->once())
49 ->method('getUser')
50 ->willReturn($this->user);
51
52 $this->tokenStorage->expects($this->once())
53 ->method('getToken')
54 ->willReturn($token);
55
56 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager') 39 $this->em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
57 ->disableOriginalConstructor() 40 ->disableOriginalConstructor()
58 ->getMock(); 41 ->getMock();
@@ -66,17 +49,12 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
66 ->with('pocket_consumer_key') 49 ->with('pocket_consumer_key')
67 ->willReturn($consumerKey); 50 ->willReturn($consumerKey);
68 51
69 $this->producer = $this->getMockBuilder('OldSound\RabbitMqBundle\RabbitMq\Producer')
70 ->disableOriginalConstructor()
71 ->getMock();
72
73 $pocket = new PocketImportMock( 52 $pocket = new PocketImportMock(
74 $this->tokenStorage,
75 $this->em, 53 $this->em,
76 $this->contentProxy, 54 $this->contentProxy,
77 $config, 55 $config
78 $this->producer
79 ); 56 );
57 $pocket->setUser($this->user);
80 58
81 $this->logHandler = new TestHandler(); 59 $this->logHandler = new TestHandler();
82 $logger = new Logger('test', [$this->logHandler]); 60 $logger = new Logger('test', [$this->logHandler]);