Use ::class notation where possible

This commit is contained in:
Yassine Guedidi
2022-09-01 20:54:56 +02:00
parent d1d56fbe25
commit 98af2e25f2
52 changed files with 347 additions and 250 deletions

View File

@ -28,7 +28,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -67,7 +67,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -106,7 +106,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -150,7 +150,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -195,7 +195,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -240,7 +240,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -284,7 +284,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -333,7 +333,7 @@ class ContentProxyTest extends TestCase
->method('validate')
->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')]));
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -383,7 +383,7 @@ class ContentProxyTest extends TestCase
new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'url', 'https://')])
));
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -635,7 +635,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -678,7 +678,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -717,7 +717,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -755,7 +755,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -793,7 +793,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -831,7 +831,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();
@ -870,7 +870,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$graby = $this->getMockBuilder('Graby\Graby')
$graby = $this->getMockBuilder(Graby::class)
->setMethods(['fetchContent'])
->disableOriginalConstructor()
->getMock();

View File

@ -3,6 +3,7 @@
namespace Tests\Wallabag\CoreBundle\Helper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Wallabag\CoreBundle\Entity\Config;
@ -22,7 +23,7 @@ class RedirectTest extends TestCase
protected function setUp(): void
{
$this->routerMock = $this->getMockBuilder('Symfony\Component\Routing\Router')
$this->routerMock = $this->getMockBuilder(Router::class)
->disableOriginalConstructor()
->getMock();

View File

@ -5,11 +5,13 @@ namespace Tests\Wallabag\CoreBundle\Helper;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use RulerZ\RulerZ;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
use Wallabag\CoreBundle\Entity\IgnoreOriginUserRule;
use Wallabag\CoreBundle\Helper\RuleBasedIgnoreOriginProcessor;
use Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository;
use Wallabag\UserBundle\Entity\User;
class RuleBasedIgnoreOriginProcessorTest extends TestCase
@ -193,14 +195,14 @@ class RuleBasedIgnoreOriginProcessorTest extends TestCase
private function getRulerZMock()
{
return $this->getMockBuilder('RulerZ\RulerZ')
return $this->getMockBuilder(RulerZ::class)
->disableOriginalConstructor()
->getMock();
}
private function getIgnoreOriginInstanceRuleRepositoryMock()
{
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\IgnoreOriginInstanceRuleRepository')
return $this->getMockBuilder(IgnoreOriginInstanceRuleRepository::class)
->disableOriginalConstructor()
->getMock();
}

View File

@ -2,14 +2,19 @@
namespace Tests\Wallabag\CoreBundle\Helper;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use RulerZ\RulerZ;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Entity\TaggingRule;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
use Wallabag\UserBundle\Entity\User;
class RuleBasedTaggerTest extends TestCase
@ -202,7 +207,7 @@ class RuleBasedTaggerTest extends TestCase
->method('satisfies')
->willReturn(true);
$query = $this->getMockBuilder('Doctrine\ORM\AbstractQuery')
$query = $this->getMockBuilder(AbstractQuery::class)
->disableOriginalConstructor()
->getMock();
@ -211,7 +216,7 @@ class RuleBasedTaggerTest extends TestCase
->method('getResult')
->willReturn([new Entry($user), new Entry($user)]);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
$qb = $this->getMockBuilder(QueryBuilder::class)
->disableOriginalConstructor()
->getMock();
@ -263,21 +268,21 @@ class RuleBasedTaggerTest extends TestCase
private function getRulerZMock()
{
return $this->getMockBuilder('RulerZ\RulerZ')
return $this->getMockBuilder(RulerZ::class)
->disableOriginalConstructor()
->getMock();
}
private function getTagRepositoryMock()
{
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
return $this->getMockBuilder(TagRepository::class)
->disableOriginalConstructor()
->getMock();
}
private function getEntryRepositoryMock()
{
return $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
return $this->getMockBuilder(EntryRepository::class)
->disableOriginalConstructor()
->getMock();
}