Ejemplo n.º 1
0
 /**
  * @before
  */
 public function testInsert()
 {
     $db = new DB_Functions();
     // es soll nur einmal addSpeise aufgerufen werden:
     if ($db->getSpeisen() == null) {
         $this->assertTrue($db->createTable(), 'Tabelle konnte nicht erstellt werden');
         $input = null;
         foreach (Hamming::$attribute as $attribut) {
             $input_0[$attribut['spalte']] = 0;
             $input_1[$attribut['spalte']] = 1;
         }
         $this->assertTrue($db->addSpeise($input_0, "null"), 'Speisen konnten nicht hinzugefügt werden.');
         $this->assertTrue($db->addSpeise($input_1, "eins"), 'Speisen konnten nicht hinzugefügt werden.');
     }
 }
Ejemplo n.º 2
0
<?php

require_once 'DB_Functions.php';
$db = new DB_Functions();
//Object initiation
//Table Creation
if ($db->createTable()) {
    echo "Succesfully created Table<br>";
} else {
    echo "Error Creating Table<br>";
}
//Data Insertion
if ($db->insertRows()) {
    echo "Insertion Successful<br>";
} else {
    echo "Error inserting rows<br>";
}
$t1 = microtime(true);
//recording time to calculate execution period
//Data Search
if (!$db->searchName()) {
    echo "No Name Found";
} else {
    $t2 = microtime(true);
    echo $t2 - $t1;
}