28 lines
552 B
PHP
28 lines
552 B
PHP
<?php
|
|
namespace Xxx\Tests\Support;
|
|
|
|
// The result of a FakeDb query
|
|
class FakeResult {
|
|
private array $rows;
|
|
private int $next = 0;
|
|
public int $num_rows;
|
|
|
|
public function __construct(array $rows) {
|
|
$this->rows = array_values($rows);
|
|
$this->num_rows = count($this->rows);
|
|
}
|
|
|
|
public function fetch_assoc() {
|
|
return $this->rows[$this->next++] ?? NULL;
|
|
}
|
|
|
|
public function fetch_row() {
|
|
$row = $this->fetch_assoc();
|
|
return $row === NULL ? NULL : array_values($row);
|
|
}
|
|
|
|
public function close() {
|
|
return TRUE;
|
|
}
|
|
}
|