Replaced all FQ global function and constants by explicit imports

This commit is contained in:
Alejandro Celaya
2018-10-28 08:24:06 +01:00
parent e1222de05b
commit 77d810b735
70 changed files with 235 additions and 123 deletions

View File

@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Exception;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
@@ -111,7 +112,7 @@ class CreateShortUrlActionTest extends TestCase
public function aGenericExceptionWillReturnError()
{
$this->urlShortener->urlToShortCode(Argument::type(Uri::class), Argument::type('array'), Argument::cetera())
->willThrow(\Exception::class)
->willThrow(Exception::class)
->shouldBeCalledTimes(1);
$request = ServerRequestFactory::fromGlobals()->withParsedBody([

View File

@@ -10,6 +10,7 @@ use Shlinkio\Shlink\Core\Exception;
use Shlinkio\Shlink\Core\Service\ShortUrl\DeleteShortUrlServiceInterface;
use Shlinkio\Shlink\Rest\Action\ShortUrl\DeleteShortUrlAction;
use Shlinkio\Shlink\Rest\Util\RestUtils;
use Throwable;
use Zend\Diactoros\Response\JsonResponse;
use Zend\Diactoros\ServerRequestFactory;
use Zend\I18n\Translator\Translator;
@@ -49,7 +50,7 @@ class DeleteShortUrlActionTest extends TestCase
* @test
* @dataProvider provideExceptions
*/
public function returnsErrorResponseInCaseOfException(\Throwable $e, string $error, int $statusCode)
public function returnsErrorResponseInCaseOfException(Throwable $e, string $error, int $statusCode)
{
$deleteByShortCode = $this->service->deleteByShortCode(Argument::any())->willThrow($e);

View File

@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Exception;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Service\ShortUrlService;
@@ -53,7 +54,7 @@ class ListShortUrlsActionTest extends TestCase
public function anExceptionsReturnsErrorResponse()
{
$page = 3;
$this->service->listShortUrls($page, null, [], null)->willThrow(\Exception::class)
$this->service->listShortUrls($page, null, [], null)->willThrow(Exception::class)
->shouldBeCalledTimes(1);
$response = $this->action->handle(ServerRequestFactory::fromGlobals()->withQueryParams([

View File

@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Exception;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
@@ -83,7 +84,7 @@ class ResolveShortUrlActionTest extends TestCase
public function unexpectedExceptionWillReturnError()
{
$shortCode = 'abc123';
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(\Exception::class)
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(Exception::class)
->shouldBeCalledTimes(1);
$request = ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode);

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\Action\Visit;
use Cake\Chronos\Chronos;
use Exception;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
@@ -65,7 +66,7 @@ class GetVisitsActionTest extends TestCase
{
$shortCode = 'abc123';
$this->visitsTracker->info($shortCode, Argument::type(DateRange::class))->willThrow(
\Exception::class
Exception::class
)->shouldBeCalledTimes(1);
$response = $this->action->handle(ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode));