3require_once dirname(__DIR__) .
'/dbxApi.php';
6 public array
$rows = array();
11 private int $insertId = 0;
14 if (
$dd !==
'dbxMissing' || $this->transaction) return 0;
15 $this->transaction =
true;
21 $this->transaction = false;
27 if (!$this->transaction) return 0;
28 $this->transaction =
false;
34 foreach ($this->
rows as $row) {
35 if ($row[
'missing'] === $where[
'missing']) {
36 return array(
'id' => $row[
'id'],
'count' => $row[
'count']);
43 if (!$this->transaction) return 0;
44 foreach ($this->
rows as &$row) {
45 if ((
int)$row[
'id'] === (
int)$id) {
46 $row = array_merge($row, $values);
56 if (!$this->transaction) return 0;
58 $values[
'id'] = $this->insertId;
59 $this->
rows[] = $values;
64 return $this->insertId;
77 return
$class ===
'dbxDB' ? $this->testDb : null;
80 public function user($key =
'id') {
85 $this->errors[] = $type .
': ' . $message;
89$fail =
static function (
string $message,
int $code): void {
90 fwrite(STDERR,
"FAIL: $message\n");
95$_SERVER[
'HTTP_REFERER'] =
'https://localhost/dbxapp/home/tutorial?token=secret#bereich';
101 || (
int)
$api->testDb->rows[0][
'count'] !== 2) {
102 $fail(
'Wiederholte Ressourcenfehler werden nicht in einer Zeile gezaehlt.', 1);
105if ((
$api->testDb->rows[0][
'request'] ??
'') !==
'https://localhost/dbxapp/home/tutorial') {
106 $fail(
'Aufrufende Seite wird nicht ohne sensible Querydaten gespeichert.', 2);
109if (
$api->testDb->begins !== 2 ||
$api->testDb->commits !== 2
110 ||
$api->testDb->rollbacks !== 0 ||
$api->testDb->transaction) {
111 $fail(
'dbxMissing-Schreibvorgaenge sind nicht sauber transaktional.', 3);
114if (
$api->log_missing(
'') !== 0 ||
$api->testDb->begins !== 2 ||
$api->errors !== array()) {
115 $fail(
'Leere Eintraege werden nicht sauber ignoriert.', 4);
118echo
"OK dbxApi missing log\n";
Zentrale Laufzeit-API von dbXapp.
get_system_obj(string $class, string $use='')
Laedt ein Systemobjekt aus dbx/include und bevorzugt den myX-Override.
dbxMissingLogTestDb $testDb
write_php_error_log(string $type, string $message, string $file='', int $line=0)
select1(string $dd, array $where, string $fields, int $verifyAccess)
insert(string $dd, array $values,... $options)
update(string $dd, array $values, $id,... $options)
$_SERVER['REQUEST_METHOD']
if( $firstId !==1||$secondId !==1||count( $api->testDb->rows) !==1||(int) $api->testDb->rows[0][ 'count'] !==2) if(($api->testDb->rows[0]['request'] ?? '') !=='https://localhost/dbxapp/home/tutorial') if( $api->testDb->begins !==2||$api->testDb->commits !==2||$api->testDb->rollbacks !==0||$api->testDb->transaction) if( $api->log_missing('') !==0||$api->testDb->begins !==2||$api->errors !==array())
$existingDb rows['dbx|dbxUser'][]