mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Migrate from PHPUnit annotations to native attributes
This commit is contained in:
@@ -6,6 +6,8 @@ namespace ShlinkioTest\Shlink\Core\Visit\Geolocation;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Exception;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Core\Exception\IpCannotBeLocatedException;
|
||||
@@ -38,10 +40,7 @@ class VisitLocatorTest extends TestCase
|
||||
$this->visitService = new VisitLocator($this->em, $this->repo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideMethodNames
|
||||
*/
|
||||
#[Test, DataProvider('provideMethodNames')]
|
||||
public function locateVisitsIteratesAndLocatesExpectedVisits(
|
||||
string $serviceMethodName,
|
||||
string $expectedRepoMethodName,
|
||||
@@ -79,10 +78,7 @@ class VisitLocatorTest extends TestCase
|
||||
yield 'locateAllVisits' => ['locateAllVisits', 'findAllVisits'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideIsNonLocatableAddress
|
||||
*/
|
||||
#[Test, DataProvider('provideIsNonLocatableAddress')]
|
||||
public function visitsWhichCannotBeLocatedAreIgnoredOrLocatedAsEmpty(
|
||||
string $serviceMethodName,
|
||||
string $expectedRepoMethodName,
|
||||
|
||||
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Core\Visit\Geolocation;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Util\IpAddress;
|
||||
@@ -25,10 +27,7 @@ class VisitToLocationHelperTest extends TestCase
|
||||
$this->helper = new VisitToLocationHelper($this->ipLocationResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideNonLocatableVisits
|
||||
*/
|
||||
#[Test, DataProvider('provideNonLocatableVisits')]
|
||||
public function throwsExpectedErrorForNonLocatableVisit(
|
||||
Visit $visit,
|
||||
IpCannotBeLocatedException $expectedException,
|
||||
@@ -48,7 +47,7 @@ class VisitToLocationHelperTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/** @test */
|
||||
#[Test]
|
||||
public function throwsGenericErrorWhenResolvingIpFails(): void
|
||||
{
|
||||
$e = new WrongIpException('');
|
||||
|
||||
Reference in New Issue
Block a user