public function testTranslog() { $db = Database::tDataConnect(); $errors = InstallUtilities::createTransDBs($db, CoreLocal::get('tDatabase')); $this->assertInternalType('array', $errors); $this->assertInternalType('array', $errors); foreach ($errors as $error) { $this->assertInternalType('array', $error, 'Invalid status entry'); $this->assertArrayHasKey('error', $error, 'Status entry missing key: error'); $this->assertEquals(0, $error['error'], 'Error creating ' . $error['struct'] . ', ' . print_r($error, true)); if (isset($error['query']) && stristr($error['query'], 'DROP VIEW')) { // don't check for existence on DROP VIEW queries continue; } $exists = $db->table_exists($error['struct']); $this->assertEquals(true, $exists, 'Failed to create ' . $error['struct'] . ', ' . print_r($error, true)); } }
$desc = $_REQUEST['TAX_DESC'][$i]; if (is_numeric($rate)) { $desc = str_replace(" ", "", $desc); $queries[] = sprintf("INSERT INTO taxrates VALUES \n (%d,%f,'%s')", $i + 1, $rate, $desc); } else { if ($rate != "") { echo "<br /><b>Error</b>: the given\n tax rate, {$rate}, doesn't seem to\n be a number."; } } $sql->query("TRUNCATE TABLE taxrates"); foreach ($queries as $q) { $sql->query($q); } } } $transErrors = InstallUtilities::createTransDBs($sql, CoreLocal::get('tDatabase')); $transErrors = array_filter($transErrors, function ($x) { return $x['error'] != 0; }); $gotDBs++; if (!empty($transErrors)) { echo '<div class="db_create_errors" style="border: solid 1px red;padding:5px;">'; echo 'There were some errors creating transactional DB structure'; echo '<ul style="margin-top:2px;">'; foreach ($transErrors as $error) { if ($error['error'] == 0) { continue; // no error occurred } echo '<li>'; echo 'Error on structure <b>' . $error['struct'] . '</b>. ';