Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
#6760 #6787 - simplified test logic (skip test early if it has to be …
Browse files Browse the repository at this point in the history
…skipped)
  • Loading branch information
Ocramius committed Dec 31, 2014
1 parent d4e9c1c commit 01bc2bf
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/ZendTest/Db/Adapter/Driver/Pgsql/ConnectionTest.php
Expand Up @@ -56,31 +56,31 @@ public function testResource()
*/
public function testGetConnectionStringEncodeSpecialSymbol()
{
if (extension_loaded('pgsql')) {
$connectionParameters = array(
'driver' => 'pgsql',
'host' => 'localhost',
'post' => '5432',
'dbname' => 'test',
'username' => 'test',
'password' => 'test123!',
);
if (! extension_loaded('pgsql')) {
$this->markTestSkipped('pgsql extension not loaded');
}

$this->connection->setConnectionParameters($connectionParameters);
$connectionParameters = array(
'driver' => 'pgsql',
'host' => 'localhost',
'post' => '5432',
'dbname' => 'test',
'username' => 'test',
'password' => 'test123!',
);

$getConnectionString = new ReflectionMethod(
'Zend\Db\Adapter\Driver\Pgsql\Connection',
'getConnectionString'
);
$this->connection->setConnectionParameters($connectionParameters);

$getConnectionString->setAccessible(true);
$getConnectionString = new ReflectionMethod(
'Zend\Db\Adapter\Driver\Pgsql\Connection',
'getConnectionString'
);

$this->assertEquals(
'host=localhost user=test password=test123! dbname=test',
$getConnectionString->invoke($this->connection)
);
} else {
$this->markTestSkipped('pgsql extension not loaded');
}
$getConnectionString->setAccessible(true);

$this->assertEquals(
'host=localhost user=test password=test123! dbname=test',
$getConnectionString->invoke($this->connection)
);
}
}

0 comments on commit 01bc2bf

Please sign in to comment.