aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Tests/Import
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-02-11 15:48:20 +0100
committerThomas Citharel <tcit@tcit.fr>2016-02-11 15:48:20 +0100
commiteaf9dad777e84d50e8b3e5877b05605ad9138fee (patch)
tree69b41409e9d39d7718fc9c8fb8409ab599387be1 /src/Wallabag/ImportBundle/Tests/Import
parentda0a9e01e9b6ef52656aa47367bfc30b1905fe40 (diff)
downloadwallabag-eaf9dad777e84d50e8b3e5877b05605ad9138fee.tar.gz
wallabag-eaf9dad777e84d50e8b3e5877b05605ad9138fee.tar.zst
wallabag-eaf9dad777e84d50e8b3e5877b05605ad9138fee.zip
add tests
Diffstat (limited to 'src/Wallabag/ImportBundle/Tests/Import')
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php15
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php4
2 files changed, 14 insertions, 5 deletions
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
index 093420f9..9a563a11 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php
@@ -57,19 +57,28 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
57 ->disableOriginalConstructor() 57 ->disableOriginalConstructor()
58 ->getMock(); 58 ->getMock();
59 59
60 $entryRepo->expects($this->exactly(3)) 60 $entryRepo->expects($this->exactly(4))
61 ->method('findByUrlAndUserId') 61 ->method('findByUrlAndUserId')
62 ->will($this->onConsecutiveCalls(false, true, false)); 62 ->will($this->onConsecutiveCalls(false, true, false, false));
63 63
64 $this->em 64 $this->em
65 ->expects($this->any()) 65 ->expects($this->any())
66 ->method('getRepository') 66 ->method('getRepository')
67 ->willReturn($entryRepo); 67 ->willReturn($entryRepo);
68 68
69 $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
70 ->disableOriginalConstructor()
71 ->getMock();
72
73 $this->contentProxy
74 ->expects($this->once())
75 ->method('updateEntry')
76 ->willReturn($entry);
77
69 $res = $wallabagV1Import->import(); 78 $res = $wallabagV1Import->import();
70 79
71 $this->assertTrue($res); 80 $this->assertTrue($res);
72 $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV1Import->getSummary()); 81 $this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary());
73 } 82 }
74 83
75 public function testImportBadFile() 84 public function testImportBadFile()
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php
index ebabb8f7..3268cd3e 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php
@@ -57,7 +57,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
57 ->disableOriginalConstructor() 57 ->disableOriginalConstructor()
58 ->getMock(); 58 ->getMock();
59 59
60 $entryRepo->expects($this->exactly(2)) 60 $entryRepo->expects($this->exactly(3))
61 ->method('findByUrlAndUserId') 61 ->method('findByUrlAndUserId')
62 ->will($this->onConsecutiveCalls(false, true, false)); 62 ->will($this->onConsecutiveCalls(false, true, false));
63 63
@@ -69,7 +69,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
69 $res = $wallabagV2Import->import(); 69 $res = $wallabagV2Import->import();
70 70
71 $this->assertTrue($res); 71 $this->assertTrue($res);
72 $this->assertEquals(['skipped' => 1, 'imported' => 1], $wallabagV2Import->getSummary()); 72 $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary());
73 } 73 }
74 74
75 public function testImportBadFile() 75 public function testImportBadFile()