Add PHP unit tests and page tests.
Run "composer install", then "composer test".
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user