Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F14039379
BasePDOTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
881 B
Referenced Files
None
Subscribers
None
BasePDOTestCase.php
View Options
<?php
namespace
Keruald\Database\Tests\Engines
;
use
Keruald\Database\Engines\PDOEngine
;
use
Keruald\Database\Exceptions\SqlException
;
use
PHPUnit\Framework\TestCase
;
abstract
class
BasePDOTestCase
extends
TestCase
{
protected
PDOEngine
$db
;
protected
static
abstract
function
buildEngine
()
:
PDOEngine
;
protected
function
setUp
():
void
{
$this
->
db
=
static
::
buildEngine
();
}
public
function
testQueryScalar
():
void
{
$sql
=
"SELECT 1+1"
;
$this
->
assertEquals
(
2
,
$this
->
db
->
queryScalar
(
$sql
));
}
public
function
testQueryScalarWithoutQuery
():
void
{
$this
->
assertEquals
(
""
,
$this
->
db
->
queryScalar
(
""
));
}
public
function
testQueryScalarWithWrongQuery
():
void
{
$this
->
expectException
(
SqlException
::
class
);
$sql
=
"DELETE FROM nonexisting"
;
$this
->
db
->
queryScalar
(
$sql
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 17:35 (20 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3137814
Default Alt Text
BasePDOTestCase.php (881 B)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment