File: 0001-Modernize-PHPUnit-syntax.patch

package info (click to toggle)
php-doctrine-dbal 4.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,092 kB
  • sloc: php: 60,293; xml: 618; makefile: 23
file content (77 lines) | stat: -rw-r--r-- 2,873 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
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/StatementTest.php                 |  3 +++
 2 files changed, 17 insertions(+)

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/StatementTest.php b/tests/Functional/StatementTest.php
index 43a9246..6d4f343 100644
--- a/tests/Functional/StatementTest.php
+++ b/tests/Functional/StatementTest.php
@@ -18,6 +18,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;
@@ -125,6 +126,7 @@ class StatementTest extends FunctionalTestCase
         ], $result->fetchAllNumeric());
     }
 
+    #[RequiresPhpunit('< 12')]
     public function testFetchLongBlob(): void
     {
         if (TestUtil::isDriverOneOf('pdo_oci')) {
@@ -296,6 +298,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();