Skip to content

Commit

Permalink
fix testWillDisconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
zajca committed Apr 19, 2022
1 parent 00b296a commit 5160f81
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/Functional/Teradata/TestConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,21 @@ public function testWillDisconnect(): void
'port' => (int) getenv('TERADATA_PORT'),
'dbname' => '',
]);
$wrappedConnection->connect(); // create odbc resource

// get retry wrapper
$wrappedConnectionRef = new \ReflectionClass($wrappedConnection);
$wrappedConnectionPropRef = $wrappedConnectionRef->getProperty('_conn');
$wrappedConnectionPropRef->setAccessible(true);
$wrappedConnection->connect(); // create odbc resource
$teradataConnection = $wrappedConnectionPropRef->getValue($wrappedConnection);
$teradataConnectionPropRef = new \ReflectionClass($teradataConnection);
$teradataConnectionPropRef = $teradataConnectionPropRef->getProperty('conn');
$retryWrappedConnection = $wrappedConnectionPropRef->getValue($wrappedConnection);
// now get teradata connection from retry wrapper
$retryWrappedConnectionRef = new \ReflectionClass($retryWrappedConnection);
$retryWrappedConnectionPropRef = $retryWrappedConnectionRef->getProperty('connection');
$retryWrappedConnectionPropRef->setAccessible(true);
$teradataConnection = $retryWrappedConnectionPropRef->getValue($retryWrappedConnection);
// now get odbc connection
$teradataConnectionRef = new \ReflectionClass($teradataConnection);
$teradataConnectionPropRef = $teradataConnectionRef->getProperty('conn');
$teradataConnectionPropRef->setAccessible(true);
// check resource exists
$this->assertIsResource($teradataConnectionPropRef->getValue($teradataConnection));
Expand Down

0 comments on commit 5160f81

Please sign in to comment.