File: 0001-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-doctrine-dbal 4.2.3%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,644 kB
  • sloc: php: 46,471; xml: 460; makefile: 22
file content (131 lines) | stat: -rw-r--r-- 5,363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sat, 8 Mar 2025 19:06:38 +0100
Subject: Modernize PHPUnit syntax

---
 tests/Functional/Driver/AbstractDriverTestCase.php | 14 ++++++++++++++
 tests/Functional/Platform/RenameColumnTest.php     |  4 ++--
 tests/Functional/Schema/SchemaManagerTest.php      |  5 +++--
 tests/Functional/StatementTest.php                 |  3 +++
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/tests/Functional/Driver/AbstractDriverTestCase.php b/tests/Functional/Driver/AbstractDriverTestCase.php
index 8ea7047..95136a7 100644
--- a/tests/Functional/Driver/AbstractDriverTestCase.php
+++ b/tests/Functional/Driver/AbstractDriverTestCase.php
@@ -7,7 +7,9 @@ namespace Doctrine\DBAL\Tests\Functional\Driver;
 use Doctrine\DBAL\Connection;
 use Doctrine\DBAL\Driver;
 use Doctrine\DBAL\Tests\FunctionalTestCase;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 use PHPUnit\Framework\Constraint\IsType;
+use PHPUnit\Framework\NativeType;
 
 abstract class AbstractDriverTestCase extends FunctionalTestCase
 {
@@ -47,6 +49,7 @@ abstract class AbstractDriverTestCase extends FunctionalTestCase
         );
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testProvidesAccessToTheNativeConnection(): void
     {
         $nativeConnection = $this->connection->getNativeConnection();
@@ -57,6 +60,17 @@ abstract class AbstractDriverTestCase extends FunctionalTestCase
         ));
     }
 
+    #[RequiresPhpunit('>= 12')]
+    public function testProvidesAccessToTheNativeConnection12(): void
+    {
+        $nativeConnection = $this->connection->getNativeConnection();
+
+        self::assertThat($nativeConnection, self::logicalOr(
+            new IsType(NativeType::Object),
+            new IsType(NativeType::Resource),
+        ));
+    }
+
     abstract protected function createDriver(): Driver;
 
     protected static function getDatabaseNameForConnectionWithoutDatabaseNameParameter(): ?string
diff --git a/tests/Functional/Platform/RenameColumnTest.php b/tests/Functional/Platform/RenameColumnTest.php
index c32e997..ac03416 100644
--- a/tests/Functional/Platform/RenameColumnTest.php
+++ b/tests/Functional/Platform/RenameColumnTest.php
@@ -15,7 +15,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
 
 class RenameColumnTest extends FunctionalTestCase
 {
-    /** @dataProvider columnNameProvider */
+    #[DataProvider('columnNameProvider')]
     public function testColumnPositionRetainedAfterImplicitRenaming(string $columnName, string $newColumnName): void
     {
         $table = new Table('test_rename');
@@ -59,7 +59,7 @@ class RenameColumnTest extends FunctionalTestCase
         return $renamed;
     }
 
-    /** @dataProvider columnNameProvider */
+    #[DataProvider('columnNameProvider')]
     public function testColumnPositionRetainedAfterExplicitRenaming(string $columnName, string $newColumnName): void
     {
         $table = new Table('test_rename');
diff --git a/tests/Functional/Schema/SchemaManagerTest.php b/tests/Functional/Schema/SchemaManagerTest.php
index 1b3735a..a35a093 100644
--- a/tests/Functional/Schema/SchemaManagerTest.php
+++ b/tests/Functional/Schema/SchemaManagerTest.php
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager;
 use Doctrine\DBAL\Schema\Table;
 use Doctrine\DBAL\Tests\FunctionalTestCase;
 use Doctrine\DBAL\Types\Types;
+use PHPUnit\Framework\Attributes\DataProvider;
 
 final class SchemaManagerTest extends FunctionalTestCase
 {
@@ -20,7 +21,7 @@ final class SchemaManagerTest extends FunctionalTestCase
         $this->schemaManager = $this->connection->createSchemaManager();
     }
 
-    /** @dataProvider dataEmptyDiffRegardlessOfForeignTableQuotes */
+    #[DataProvider('dataEmptyDiffRegardlessOfForeignTableQuotes')]
     public function testEmptyDiffRegardlessOfForeignTableQuotes(string $foreignTableName): void
     {
         if (! $this->connection->getDatabasePlatform()->supportsSchemas()) {
@@ -58,7 +59,7 @@ final class SchemaManagerTest extends FunctionalTestCase
         ];
     }
 
-    /** @dataProvider dataDropIndexInAnotherSchema */
+    #[DataProvider('dataDropIndexInAnotherSchema')]
     public function testDropIndexInAnotherSchema(string $tableName): void
     {
         if (! $this->connection->getDatabasePlatform()->supportsSchemas()) {
diff --git a/tests/Functional/StatementTest.php b/tests/Functional/StatementTest.php
index 0ae12a9..da3125f 100644
--- a/tests/Functional/StatementTest.php
+++ b/tests/Functional/StatementTest.php
@@ -17,6 +17,7 @@ use Doctrine\DBAL\Tests\TestUtil;
 use Doctrine\DBAL\Types\Type;
 use Doctrine\DBAL\Types\Types;
 use Error;
+use PHPUnit\Framework\Attributes\RequiresPhpunit;
 
 use function base64_decode;
 use function get_debug_type;
@@ -92,6 +93,7 @@ class StatementTest extends FunctionalTestCase
         ], $result->fetchAllNumeric());
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testFetchLongBlob(): void
     {
         if (TestUtil::isDriverOneOf('pdo_oci')) {
@@ -254,6 +256,7 @@ EOF
      * 1. Not all underlying drivers report this as an error.
      * 2. It is a logical error which requires a code change and should not be handled at runtime.
      */
+    #[RequiresPhpunit('< 12')]
     public function testExecWithRedundantParameters(): void
     {
         $driver = $this->connection->getDriver();