Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F14041839
PostgreSQLPDOEngineTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PostgreSQLPDOEngineTest.php
View Options
<?php
namespace
Keruald\Database\Tests\Engines
;
use
Keruald\Database\Engines\PDOEngine
;
use
Keruald\Database\Engines\PostgreSQLPDOEngine
;
use
Keruald\Database\Exceptions\EngineSetupException
;
use
PDO
;
class
PostgreSQLPDOEngineTest
extends
BasePDOPostgreSQLTestCase
{
protected
static
function
buildEngine
()
:
PDOEngine
{
return
new
PostgreSQLPDOEngine
(
'localhost'
,
'keruald'
,
'keruald'
,
self
::
DB_NAME
,
);
}
public
function
testLoad
()
:
void
{
$instance
=
PostgreSQLPDOEngine
::
load
([
'host'
=>
'localhost'
,
'username'
=>
'keruald'
,
'password'
=>
'keruald'
,
'database'
=>
self
::
DB_NAME
,
]);
$this
->
assertInstanceOf
(
PDO
::
class
,
$instance
->
getUnderlyingDriver
());
}
public
function
testLoadWithWrongPassword
():
void
{
$this
->
expectException
(
EngineSetupException
::
class
);
PostgreSQLPDOEngine
::
load
([
'host'
=>
'localhost'
,
'username'
=>
'notexisting'
,
'password'
=>
'notexistingeither'
,
'database'
=>
self
::
DB_NAME
,
]);
}
public
function
testLoadWithFetchMode
():
void
{
$instance
=
PostgreSQLPDOEngine
::
load
([
'host'
=>
'localhost'
,
'username'
=>
'keruald'
,
'password'
=>
'keruald'
,
'database'
=>
self
::
DB_NAME
,
'fetch_mode'
=>
PDO
::
FETCH_BOTH
,
]);
$result
=
$instance
->
query
(
"SELECT 1 as num"
);
$row
=
$result
->
fetchRow
();
// Should have both numeric and associative keys
$this
->
assertArrayHasKey
(
0
,
$row
);
$this
->
assertArrayHasKey
(
'num'
,
$row
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 17:59 (4 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3138540
Default Alt Text
PostgreSQLPDOEngineTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment