Files
xxx/tests/php/Support/FakeResult.php
T
tim ed959888b4 Add PHP unit tests and page tests.
Run "composer install", then "composer test".
2026-09-26 03:48:09 +02:00

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;
}
}