-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #847 from deeky666/DBAL-1218
[DBAL-1218] Fix retrieving the database name connected to for SQL Anywhere
- Loading branch information
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional\Driver\SQLAnywhere; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Doctrine\DBAL\Driver\SQLAnywhere\Driver; | ||
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest; | ||
|
||
class DriverTest extends AbstractDriverTest | ||
{ | ||
protected function setUp() | ||
{ | ||
if (! extension_loaded('sqlanywhere')) { | ||
$this->markTestSkipped('sqlanywhere is not installed.'); | ||
} | ||
|
||
parent::setUp(); | ||
|
||
if (! $this->_conn->getDriver() instanceof Driver) { | ||
$this->markTestSkipped('sqlanywhere only test.'); | ||
} | ||
} | ||
|
||
public function testReturnsDatabaseNameWithoutDatabaseNameParameter() | ||
{ | ||
$params = $this->_conn->getParams(); | ||
unset($params['dbname']); | ||
|
||
$connection = new Connection( | ||
$params, | ||
$this->_conn->getDriver(), | ||
$this->_conn->getConfiguration(), | ||
$this->_conn->getEventManager() | ||
); | ||
|
||
// SQL Anywhere has no "default" database. The name of the default database | ||
// is defined on server startup and therefore can be arbitrary. | ||
$this->assertInternalType('string', $this->driver->getDatabase($connection)); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function createDriver() | ||
{ | ||
return new Driver(); | ||
} | ||
} |