aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Helper
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/CoreBundle/Helper')
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php19
-rw-r--r--tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php3
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php3
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php3
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php3
-rw-r--r--tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php3
6 files changed, 24 insertions, 10 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 5c99e461..398592e1 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Helper;
5use Graby\Graby; 5use Graby\Graby;
6use Monolog\Handler\TestHandler; 6use Monolog\Handler\TestHandler;
7use Monolog\Logger; 7use Monolog\Logger;
8use PHPUnit\Framework\TestCase;
8use Psr\Log\NullLogger; 9use Psr\Log\NullLogger;
9use Symfony\Component\Validator\ConstraintViolation; 10use Symfony\Component\Validator\ConstraintViolation;
10use Symfony\Component\Validator\ConstraintViolationList; 11use Symfony\Component\Validator\ConstraintViolationList;
@@ -15,7 +16,7 @@ use Wallabag\CoreBundle\Helper\ContentProxy;
15use Wallabag\CoreBundle\Helper\RuleBasedTagger; 16use Wallabag\CoreBundle\Helper\RuleBasedTagger;
16use Wallabag\UserBundle\Entity\User; 17use Wallabag\UserBundle\Entity\User;
17 18
18class ContentProxyTest extends \PHPUnit_Framework_TestCase 19class ContentProxyTest extends TestCase
19{ 20{
20 private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.'; 21 private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.';
21 22
@@ -220,7 +221,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
220 $tagger->expects($this->once()) 221 $tagger->expects($this->once())
221 ->method('tag'); 222 ->method('tag');
222 223
223 $validator = $this->getValidator(); 224 $validator = $this->getValidator(false);
224 $validator->expects($this->once()) 225 $validator->expects($this->once())
225 ->method('validate') 226 ->method('validate')
226 ->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')])); 227 ->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')]));
@@ -261,7 +262,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
261 $tagger->expects($this->once()) 262 $tagger->expects($this->once())
262 ->method('tag'); 263 ->method('tag');
263 264
264 $validator = $this->getValidator(); 265 $validator = $this->getValidator(false);
265 $validator->expects($this->exactly(2)) 266 $validator->expects($this->exactly(2))
266 ->method('validate') 267 ->method('validate')
267 ->will($this->onConsecutiveCalls( 268 ->will($this->onConsecutiveCalls(
@@ -544,11 +545,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
544 return new NullLogger(); 545 return new NullLogger();
545 } 546 }
546 547
547 private function getValidator() 548 private function getValidator($withDefaultMock = true)
548 { 549 {
549 return $this->getMockBuilder(RecursiveValidator::class) 550 $mock = $this->getMockBuilder(RecursiveValidator::class)
550 ->setMethods(['validate']) 551 ->setMethods(['validate'])
551 ->disableOriginalConstructor() 552 ->disableOriginalConstructor()
552 ->getMock(); 553 ->getMock();
554
555 if ($withDefaultMock) {
556 $mock->expects($this->any())
557 ->method('validate')
558 ->willReturn(new ConstraintViolationList());
559 }
560
561 return $mock;
553 } 562 }
554} 563}
diff --git a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php
index 782c29c3..7398f235 100644
--- a/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php
@@ -4,10 +4,11 @@ namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Monolog\Handler\TestHandler; 5use Monolog\Handler\TestHandler;
6use Monolog\Logger; 6use Monolog\Logger;
7use PHPUnit\Framework\TestCase;
7use Psr\Log\NullLogger; 8use Psr\Log\NullLogger;
8use Wallabag\CoreBundle\Helper\CryptoProxy; 9use Wallabag\CoreBundle\Helper\CryptoProxy;
9 10
10class CryptoProxyTest extends \PHPUnit_Framework_TestCase 11class CryptoProxyTest extends TestCase
11{ 12{
12 public function testCrypto() 13 public function testCrypto()
13 { 14 {
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index c61f65d0..0e1d296b 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -8,9 +8,10 @@ use GuzzleHttp\Stream\Stream;
8use GuzzleHttp\Subscriber\Mock; 8use GuzzleHttp\Subscriber\Mock;
9use Monolog\Handler\TestHandler; 9use Monolog\Handler\TestHandler;
10use Monolog\Logger; 10use Monolog\Logger;
11use PHPUnit\Framework\TestCase;
11use Wallabag\CoreBundle\Helper\DownloadImages; 12use Wallabag\CoreBundle\Helper\DownloadImages;
12 13
13class DownloadImagesTest extends \PHPUnit_Framework_TestCase 14class DownloadImagesTest extends TestCase
14{ 15{
15 public function dataForSuccessImage() 16 public function dataForSuccessImage()
16 { 17 {
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
index 7fd2ea2b..04e1a59c 100644
--- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
@@ -2,13 +2,14 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use PHPUnit\Framework\TestCase;
5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 6use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
6use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; 7use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
7use Wallabag\CoreBundle\Entity\Config; 8use Wallabag\CoreBundle\Entity\Config;
8use Wallabag\CoreBundle\Helper\Redirect; 9use Wallabag\CoreBundle\Helper\Redirect;
9use Wallabag\UserBundle\Entity\User; 10use Wallabag\UserBundle\Entity\User;
10 11
11class RedirectTest extends \PHPUnit_Framework_TestCase 12class RedirectTest extends TestCase
12{ 13{
13 /** @var \PHPUnit_Framework_MockObject_MockObject */ 14 /** @var \PHPUnit_Framework_MockObject_MockObject */
14 private $routerMock; 15 private $routerMock;
diff --git a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
index c31af680..74b28bbb 100644
--- a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
@@ -4,6 +4,7 @@ namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Monolog\Handler\TestHandler; 5use Monolog\Handler\TestHandler;
6use Monolog\Logger; 6use Monolog\Logger;
7use PHPUnit\Framework\TestCase;
7use Wallabag\CoreBundle\Entity\Config; 8use Wallabag\CoreBundle\Entity\Config;
8use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\CoreBundle\Entity\Tag; 10use Wallabag\CoreBundle\Entity\Tag;
@@ -11,7 +12,7 @@ use Wallabag\CoreBundle\Entity\TaggingRule;
11use Wallabag\CoreBundle\Helper\RuleBasedTagger; 12use Wallabag\CoreBundle\Helper\RuleBasedTagger;
12use Wallabag\UserBundle\Entity\User; 13use Wallabag\UserBundle\Entity\User;
13 14
14class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase 15class RuleBasedTaggerTest extends TestCase
15{ 16{
16 private $rulerz; 17 private $rulerz;
17 private $tagRepository; 18 private $tagRepository;
diff --git a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php
index 475cd349..1285c99c 100644
--- a/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php
@@ -2,13 +2,14 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use PHPUnit\Framework\TestCase;
5use Wallabag\CoreBundle\Entity\Entry; 6use Wallabag\CoreBundle\Entity\Entry;
6use Wallabag\CoreBundle\Entity\Tag; 7use Wallabag\CoreBundle\Entity\Tag;
7use Wallabag\CoreBundle\Helper\TagsAssigner; 8use Wallabag\CoreBundle\Helper\TagsAssigner;
8use Wallabag\CoreBundle\Repository\TagRepository; 9use Wallabag\CoreBundle\Repository\TagRepository;
9use Wallabag\UserBundle\Entity\User; 10use Wallabag\UserBundle\Entity\User;
10 11
11class TagsAssignerTest extends \PHPUnit_Framework_TestCase 12class TagsAssignerTest extends TestCase
12{ 13{
13 public function testAssignTagsWithArrayAndExtraSpaces() 14 public function testAssignTagsWithArrayAndExtraSpaces()
14 { 15 {