55namespace Doctrine \DBAL \Tests \Driver \AbstractOracleDriver ;
66
77use Doctrine \DBAL \Driver \AbstractOracleDriver \EasyConnectString ;
8- use Doctrine \Deprecations \ PHPUnit \ VerifyDeprecations ;
8+ use Doctrine \DBAL \ Driver \ AbstractOracleDriver \ Exception \ InvalidConfiguration ;
99use PHPUnit \Framework \Attributes \DataProvider ;
1010use PHPUnit \Framework \TestCase ;
1111
1212class EasyConnectStringTest extends TestCase
1313{
14- use VerifyDeprecations;
15-
1614 /** @param mixed[] $params */
1715 #[DataProvider('connectionParametersProvider ' )]
1816 public function testFromConnectionParameters (array $ params , string $ expected ): void
@@ -26,15 +24,15 @@ public function testFromConnectionParameters(array $params, string $expected): v
2624 public static function connectionParametersProvider (): iterable
2725 {
2826 return [
29- 'common-params ' => [
27+ 'sid ' => [
3028 [
3129 'host ' => 'oracle.example.com ' ,
3230 'port ' => 1521 ,
33- 'dbname ' => 'XE ' ,
31+ 'sid ' => 'XE ' ,
3432 ],
3533 '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle.example.com)(PORT=1521))(CONNECT_DATA=(SID=XE))) ' ,
3634 ],
37- 'no-db -name ' => [
35+ 'no-service -name-or-sid ' => [
3836 ['host ' => 'localhost ' ],
3937 '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) ' ,
4038 ],
@@ -51,7 +49,7 @@ public static function connectionParametersProvider(): iterable
5149 [
5250 'host ' => 'localhost ' ,
5351 'port ' => 41521 ,
54- 'dbname ' => 'XE ' ,
52+ 'sid ' => 'XE ' ,
5553 'instancename ' => 'SALES ' ,
5654 'pooled ' => true ,
5755 ],
@@ -62,7 +60,7 @@ public static function connectionParametersProvider(): iterable
6260 [
6361 'host ' => 'localhost ' ,
6462 'port ' => 41521 ,
65- 'dbname ' => 'XE ' ,
63+ 'sid ' => 'XE ' ,
6664 'instancename ' => 'SALES ' ,
6765 'pooled ' => true ,
6866 'driverOptions ' => ['protocol ' => 'TCPS ' ],
@@ -73,57 +71,10 @@ public static function connectionParametersProvider(): iterable
7371 ];
7472 }
7573
76- /** @param array<string, mixed> $parameters */
77- #[DataProvider('getConnectionParameters ' )]
78- public function testParameterDeprecation (
79- array $ parameters ,
80- string $ expectedConnectString ,
81- bool $ expectDeprecation ,
82- ): void {
83- if ($ expectDeprecation ) {
84- $ this ->expectDeprecationWithIdentifier ('https://github.com/doctrine/dbal/pull/7239 ' );
85- } else {
86- $ this ->expectNoDeprecationWithIdentifier ('https://github.com/doctrine/dbal/pull/7239 ' );
87- }
88-
89- $ string = EasyConnectString::fromConnectionParameters ($ parameters );
90-
91- self ::assertSame ($ expectedConnectString , (string ) $ string );
92- }
93-
94- /** @return iterable<string, array{array<string, mixed>, string, bool}> */
95- public static function getConnectionParameters (): iterable
96- {
97- $ sidString = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)) '
98- . '(CONNECT_DATA=(SID=BILLING))) ' ;
99-
100- yield 'dbname ' => [
101- [
102- 'host ' => 'localhost ' ,
103- 'port ' => 1521 ,
104- 'dbname ' => 'BILLING ' ,
105- ],
106- $ sidString ,
107- true ,
108- ];
109-
110- yield 'sid ' => [
111- [
112- 'host ' => 'localhost ' ,
113- 'port ' => 1521 ,
114- 'sid ' => 'BILLING ' ,
115- ],
116- $ sidString ,
117- false ,
118- ];
119- }
120-
12174 public function testNoHostOrConnectStringSpecified (): void
12275 {
123- $ this ->expectDeprecationWithIdentifier ('https://github.com/doctrine/dbal/pull/7244 ' );
124-
125- $ string = EasyConnectString::fromConnectionParameters ([]);
76+ $ this ->expectException (InvalidConfiguration::class);
12677
127- self :: assertSame ( '' , ( string ) $ string );
78+ EasyConnectString:: fromConnectionParameters ([] );
12879 }
12980}
0 commit comments