19
19
use Doctrine \DBAL \Schema \SchemaManagerFactory ;
20
20
use Doctrine \DBAL \Schema \SQLiteSchemaManager ;
21
21
use Doctrine \DBAL \ServerVersionProvider ;
22
+ use PHPUnit \Framework \Attributes \DataProvider ;
23
+ use PHPUnit \Framework \Attributes \RequiresPhpExtension ;
22
24
use PHPUnit \Framework \MockObject \MockObject ;
23
25
use PHPUnit \Framework \TestCase ;
24
26
use Psr \Cache \CacheItemInterface ;
25
27
use Psr \Cache \CacheItemPoolInterface ;
26
28
27
- /**
28
- * @requires extension pdo_mysql
29
- * @psalm-import-type Params from DriverManager
30
- */
29
+ /** @psalm-import-type Params from DriverManager */
30
+ #[RequiresPhpExtension('pdo_mysql ' )]
31
31
class ConnectionTest extends TestCase
32
32
{
33
33
private Connection $ connection ;
@@ -45,8 +45,7 @@ protected function setUp(): void
45
45
$ this ->connection = DriverManager::getConnection (self ::CONNECTION_PARAMS );
46
46
}
47
47
48
- /** @return Connection&MockObject */
49
- private function getExecuteStatementMockConnection (): Connection
48
+ private function getExecuteStatementMockConnection (): Connection &MockObject
50
49
{
51
50
$ driverMock = $ this ->createMock (Driver::class);
52
51
@@ -95,10 +94,8 @@ public function testGetDriver(): void
95
94
self ::assertInstanceOf (Driver \PDO \MySQL \Driver::class, $ this ->connection ->getDriver ());
96
95
}
97
96
98
- /**
99
- * @requires extension pdo_sqlite
100
- * @dataProvider getQueryMethods
101
- */
97
+ #[RequiresPhpExtension('pdo_sqlite ' )]
98
+ #[DataProvider('getQueryMethods ' )]
102
99
public function testDriverExceptionIsWrapped (callable $ callback ): void
103
100
{
104
101
$ this ->expectException (Exception::class);
@@ -377,7 +374,7 @@ public function testDeleteWithIsNull(): void
377
374
);
378
375
}
379
376
380
- /** @dataProvider fetchModeProvider */
377
+ #[DataProvider( ' fetchModeProvider ' )]
381
378
public function testFetch (string $ method , callable $ invoke , mixed $ expected ): void
382
379
{
383
380
$ query = 'SELECT * FROM foo WHERE bar = ? ' ;
0 commit comments