mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 17:23:12 +08:00
Migrate from PHPUnit annotations to native attributes
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace ShlinkioTest\Shlink\Core\Visit;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -26,10 +28,7 @@ class VisitsTrackerTest extends TestCase
|
||||
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideTrackingMethodNames
|
||||
*/
|
||||
#[Test, DataProvider('provideTrackingMethodNames')]
|
||||
public function trackPersistsVisitAndDispatchesEvent(string $method, array $args): void
|
||||
{
|
||||
$this->em->expects($this->once())->method('persist')->with(
|
||||
@@ -43,10 +42,7 @@ class VisitsTrackerTest extends TestCase
|
||||
$this->visitsTracker()->{$method}(...$args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideTrackingMethodNames
|
||||
*/
|
||||
#[Test, DataProvider('provideTrackingMethodNames')]
|
||||
public function trackingIsSkippedCompletelyWhenDisabledFromOptions(string $method, array $args): void
|
||||
{
|
||||
$this->em->expects($this->never())->method('persist');
|
||||
@@ -64,10 +60,7 @@ class VisitsTrackerTest extends TestCase
|
||||
yield 'trackRegularNotFoundVisit' => ['trackRegularNotFoundVisit', [Visitor::emptyInstance()]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideOrphanTrackingMethodNames
|
||||
*/
|
||||
#[Test, DataProvider('provideOrphanTrackingMethodNames')]
|
||||
public function orphanVisitsAreNotTrackedWhenDisabled(string $method): void
|
||||
{
|
||||
$this->em->expects($this->never())->method('persist');
|
||||
|
||||
Reference in New Issue
Block a user