EmptyStatementTest.php in Zircon Profile 8.0
File
core/tests/Drupal/Tests/Core/Database/EmptyStatementTest.php
View source
<?php
namespace Drupal\Tests\Core\Database;
use Drupal\Core\Database\StatementEmpty;
use Drupal\Core\Database\StatementInterface;
use Drupal\Tests\UnitTestCase;
class EmptyStatementTest extends UnitTestCase {
function testEmpty() {
$result = new StatementEmpty();
$this
->assertTrue($result instanceof StatementInterface, 'Class implements expected interface');
$this
->assertNull($result
->fetchObject(), 'Null result returned.');
}
function testEmptyIteration() {
$result = new StatementEmpty();
$this
->assertSame(0, iterator_count($result), 'Empty result set should not iterate.');
}
function testEmptyFetchAll() {
$result = new StatementEmpty();
$this
->assertEquals($result
->fetchAll(), array(), 'Empty array returned from empty result set.');
}
}