X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FImportBundle%2FTests%2FImport%2FPocketImportTest.php;h=25359d56bb1b7d7db5c1bb6dec3012972d960b36;hb=7a97c7d06fa96a4f2d8bb17817dc15b091698e80;hp=6ee70db047b0b7f61607f61a5ab3b76906fc24b7;hpb=7019c7cf6c6af39c0f458769e20c3f9306477943;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index 6ee70db0..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 ->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(); @@ -75,7 +84,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Pocket', $pocketImport->getName()); $this->assertNotEmpty($pocketImport->getUrl()); - $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription()); + $this->assertContains('This importer will import all your Pocket data.', $pocketImport->getDescription()); } public function testOAuthRequest() @@ -248,7 +257,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase ->getMock(); $entryRepo->expects($this->exactly(2)) - ->method('existByUrlAndUserId') + ->method('findByUrlAndUserId') ->will($this->onConsecutiveCalls(false, true)); $tag = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Tag') @@ -260,7 +269,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo->expects($this->exactly(2)) - ->method('findOneByLabelAndUserId') + // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method + // to magically call the `findOneBy` with ['label' => 'foo'] + ->method('__call') ->will($this->onConsecutiveCalls(false, $tag)); $this->em