@@ -75,9 +75,21 @@ public function testDisconnect(): void
7575 self ::assertFalse ($ connection ->isConnected ());
7676 }
7777
78- /**
79- * @todo Implement testBeginTransaction().
80- */
78+ public function testConnectReturnsConnectionWhenResourceSet (): void
79+ {
80+ /** @var PDO $resource */
81+ $ resource = $ this ->getAdapter ()->getDriver ()->getConnection ()->getResource ();
82+ /** @var PdoConnectionInterface&Connection $connection */
83+ $ connection = $ this ->getAdapter ()->getDriver ()->getConnection ();
84+ self ::assertInstanceOf (PdoConnectionInterface::class, $ connection );
85+ $ connection ->setResource ($ resource );
86+ self ::assertSame ($ connection , $ connection ->connect ());
87+
88+ $ connection ->disconnect ();
89+ unset($ connection );
90+ unset($ resource );
91+ }
92+
8193 // public function testBeginTransaction(): never
8294 // {
8395 // // Remove the following lines when you implement this test.
@@ -86,9 +98,6 @@ public function testDisconnect(): void
8698 // );
8799 // }
88100
89- /**
90- * @todo Implement testCommit().
91- */
92101 // public function testCommit(): never
93102 // {
94103 // // Remove the following lines when you implement this test.
@@ -97,9 +106,6 @@ public function testDisconnect(): void
97106 // );
98107 // }
99108
100- /**
101- * @todo Implement testRollback().
102- */
103109 // public function testRollback(): never
104110 // {
105111 // // Remove the following lines when you implement this test.
@@ -114,19 +120,4 @@ public function testDisconnect(): void
114120 // //$connection = new Connection($this->variables);
115121 // //$connection->getLastGeneratedValue();
116122 // }
117-
118- public function testConnectReturnsConnectionWhenResourceSet (): void
119- {
120- /** @var PDO $resource */
121- $ resource = $ this ->getAdapter ()->getDriver ()->getConnection ()->getResource ();
122- /** @var PdoConnectionInterface&Connection $connection */
123- $ connection = $ this ->getAdapter ()->getDriver ()->getConnection ();
124- self ::assertInstanceOf (PdoConnectionInterface::class, $ connection );
125- $ connection ->setResource ($ resource );
126- self ::assertSame ($ connection , $ connection ->connect ());
127-
128- $ connection ->disconnect ();
129- unset($ connection );
130- unset($ resource );
131- }
132123}
0 commit comments