Tests the empty pseudo-statement class.
Expanded class hierarchy of EmptyStatementTest
class EmptyStatementTest extends UnitTestCase {
public static function getInfo() {
return array(
'name' => 'Empty statement',
'description' => 'Test the empty pseudo-statement class.',
'group' => 'Database',
);
}
/**
* Tests that the empty result set behaves as empty.
*/
function testEmpty() {
$result = new StatementEmpty();
$this
->assertTrue($result instanceof StatementInterface, 'Class implements expected interface');
$this
->assertNull($result
->fetchObject(), 'Null result returned.');
}
/**
* Tests that the empty result set iterates safely.
*/
function testEmptyIteration() {
$result = new StatementEmpty();
foreach ($result as $record) {
$this
->fail('Iterating empty result set should not iterate.');
return;
}
}
/**
* Tests that the empty result set mass-fetches in an expected way.
*/
function testEmptyFetchAll() {
$result = new StatementEmpty();
$this
->assertEquals($result
->fetchAll(), array(), 'Empty array returned from empty result set.');
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EmptyStatementTest:: |
public static | function |
This method exists to support the simpletest UI runner. Overrides UnitTestCase:: |
|
EmptyStatementTest:: |
function | Tests that the empty result set behaves as empty. | ||
EmptyStatementTest:: |
function | Tests that the empty result set mass-fetches in an expected way. | ||
EmptyStatementTest:: |
function | Tests that the empty result set iterates safely. | ||
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
public static | function | Generates a random string containing letters and numbers. |