Page MenuHomeDevCentral

MockDatabaseResultTest.php
No OneTemporary

MockDatabaseResultTest.php

<?php
namespace Keruald\Database\Tests\Result;
use Keruald\Database\Result\MockDatabaseResult;
use PHPUnit\Framework\TestCase;
class MockDatabaseResultTest extends TestCase {
const RESULT = [
[ "name" => "strawberry", "color" => "red" ],
[ "name" => "blueberry", "color" => "violet" ],
];
private MockDatabaseResult $result;
protected function setUp () : void {
$this->result = new MockDatabaseResult(self::RESULT);
}
public function testFetchRow () {
$this->assertEquals(
[ "name" => "strawberry", "color" => "red" ],
$this->result->fetchRow(),
);
}
public function testNumRows () {
$this->assertEquals(2, $this->result->numRows());
}
public function testGetIterator () {
$i = 0;
foreach ($this->result as $row) {
$this->assertEquals(self::RESULT[$i], $row);
$i++;
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Tue, Nov 18, 17:40 (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3123913
Default Alt Text
MockDatabaseResultTest.php (946 B)

Event Timeline