mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Migrate from PHPUnit annotations to native attributes
This commit is contained in:
@@ -6,6 +6,8 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
@@ -25,10 +27,7 @@ class DomainVisitsActionTest extends TestCase
|
||||
$this->action = new DomainVisitsAction($this->visitsHelper, 'the_default.com');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideDomainAuthorities
|
||||
*/
|
||||
#[Test, DataProvider('provideDomainAuthorities')]
|
||||
public function providingCorrectDomainReturnsVisits(string $providedDomain, string $expectedDomain): void
|
||||
{
|
||||
$apiKey = ApiKey::create();
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Visit\Model\VisitsStats;
|
||||
@@ -24,7 +25,7 @@ class GlobalVisitsActionTest extends TestCase
|
||||
$this->action = new GlobalVisitsAction($this->helper);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function statsAreReturnedFromHelper(): void
|
||||
{
|
||||
$apiKey = ApiKey::create();
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
@@ -26,7 +27,7 @@ class NonOrphanVisitsActionTest extends TestCase
|
||||
$this->action = new NonOrphanVisitsAction($this->visitsHelper);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function requestIsHandled(): void
|
||||
{
|
||||
$apiKey = ApiKey::create();
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
@@ -33,7 +34,7 @@ class OrphanVisitsActionTest extends TestCase
|
||||
$this->action = new OrphanVisitsAction($this->visitsHelper, $this->orphanVisitTransformer);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function requestIsHandled(): void
|
||||
{
|
||||
$visitor = Visitor::emptyInstance();
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
@@ -29,7 +30,7 @@ class ShortUrlVisitsActionTest extends TestCase
|
||||
$this->action = new ShortUrlVisitsAction($this->visitsHelper);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function providingCorrectShortCodeReturnsVisits(): void
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
@@ -43,7 +44,7 @@ class ShortUrlVisitsActionTest extends TestCase
|
||||
self::assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function paramsAreReadFromQuery(): void
|
||||
{
|
||||
$shortCode = 'abc123';
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Action\Visit;
|
||||
|
||||
use Laminas\Diactoros\ServerRequestFactory;
|
||||
use Pagerfanta\Adapter\ArrayAdapter;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Paginator\Paginator;
|
||||
@@ -25,7 +26,7 @@ class TagVisitsActionTest extends TestCase
|
||||
$this->action = new TagVisitsAction($this->visitsHelper);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function providingCorrectTagReturnsVisits(): void
|
||||
{
|
||||
$tag = 'foo';
|
||||
|
||||
Reference in New Issue
Block a user