From bd91bd5c32dcec997e1cc1aff93f585dac093742 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 16 Dec 2017 22:17:42 +0100 Subject: Use namespaced PHPUnit classes --- tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | 3 ++- tests/Wallabag/CoreBundle/Helper/CryptoProxyTest.php | 3 ++- tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php | 3 ++- tests/Wallabag/CoreBundle/Helper/RedirectTest.php | 3 ++- tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php | 3 ++- tests/Wallabag/CoreBundle/Helper/TagsAssignerTest.php | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'tests/Wallabag/CoreBundle/Helper') diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 5c99e461..9a656dad 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Helper; use Graby\Graby; use Monolog\Handler\TestHandler; use Monolog\Logger; +use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; @@ -15,7 +16,7 @@ use Wallabag\CoreBundle\Helper\ContentProxy; use Wallabag\CoreBundle\Helper\RuleBasedTagger; use Wallabag\UserBundle\Entity\User; -class ContentProxyTest extends \PHPUnit_Framework_TestCase +class ContentProxyTest extends TestCase { private $fetchingErrorMessage = 'wallabag can\'t retrieve contents for this article. Please troubleshoot this issue.'; 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; use Monolog\Handler\TestHandler; use Monolog\Logger; +use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; use Wallabag\CoreBundle\Helper\CryptoProxy; -class CryptoProxyTest extends \PHPUnit_Framework_TestCase +class CryptoProxyTest extends TestCase { public function testCrypto() { 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; use GuzzleHttp\Subscriber\Mock; use Monolog\Handler\TestHandler; use Monolog\Logger; +use PHPUnit\Framework\TestCase; use Wallabag\CoreBundle\Helper\DownloadImages; -class DownloadImagesTest extends \PHPUnit_Framework_TestCase +class DownloadImagesTest extends TestCase { public function dataForSuccessImage() { 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 @@ namespace Tests\Wallabag\CoreBundle\Helper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Helper\Redirect; use Wallabag\UserBundle\Entity\User; -class RedirectTest extends \PHPUnit_Framework_TestCase +class RedirectTest extends TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ 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; use Monolog\Handler\TestHandler; use Monolog\Logger; +use PHPUnit\Framework\TestCase; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; @@ -11,7 +12,7 @@ use Wallabag\CoreBundle\Entity\TaggingRule; use Wallabag\CoreBundle\Helper\RuleBasedTagger; use Wallabag\UserBundle\Entity\User; -class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase +class RuleBasedTaggerTest extends TestCase { private $rulerz; 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 @@ namespace Tests\Wallabag\CoreBundle\Helper; +use PHPUnit\Framework\TestCase; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\TagsAssigner; use Wallabag\CoreBundle\Repository\TagRepository; use Wallabag\UserBundle\Entity\User; -class TagsAssignerTest extends \PHPUnit_Framework_TestCase +class TagsAssignerTest extends TestCase { public function testAssignTagsWithArrayAndExtraSpaces() { -- cgit v1.2.3 From 5661e8d42af5d0557bf8017b515c51335757d6f2 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 18 Dec 2017 10:14:00 +0100 Subject: Fix countable in tests --- tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tests/Wallabag/CoreBundle/Helper') diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 9a656dad..398592e1 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -221,7 +221,7 @@ class ContentProxyTest extends TestCase $tagger->expects($this->once()) ->method('tag'); - $validator = $this->getValidator(); + $validator = $this->getValidator(false); $validator->expects($this->once()) ->method('validate') ->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')])); @@ -262,7 +262,7 @@ class ContentProxyTest extends TestCase $tagger->expects($this->once()) ->method('tag'); - $validator = $this->getValidator(); + $validator = $this->getValidator(false); $validator->expects($this->exactly(2)) ->method('validate') ->will($this->onConsecutiveCalls( @@ -545,11 +545,19 @@ class ContentProxyTest extends TestCase return new NullLogger(); } - private function getValidator() + private function getValidator($withDefaultMock = true) { - return $this->getMockBuilder(RecursiveValidator::class) + $mock = $this->getMockBuilder(RecursiveValidator::class) ->setMethods(['validate']) ->disableOriginalConstructor() ->getMock(); + + if ($withDefaultMock) { + $mock->expects($this->any()) + ->method('validate') + ->willReturn(new ConstraintViolationList()); + } + + return $mock; } } -- cgit v1.2.3