Migrate from PHPUnit annotations to native attributes

This commit is contained in:
Alejandro Celaya
2023-02-09 20:42:18 +01:00
parent 650a286982
commit 04bbd471ff
188 changed files with 776 additions and 1082 deletions

View File

@@ -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');