示例#1
0
 public function testDelete()
 {
     $this->assertEquals([["id" => "1", "name" => "tim", "notes" => "some blob of data", "favorite_number" => "16"]], $this->tdb->get("test", 1));
     $this->tdb->delete("test", 1);
     // TODO get should return empty array if no records were found
     $this->assertEquals(false, $this->tdb->get("test", 1));
 }
示例#2
0
 public function testRemoveNonExistingTable()
 {
     $this->setExpectedException('\\TextDb\\Exception\\InvalidTableException');
     $this->tdb->createDatabase($this->tmpFolder, $this->dbName);
     $this->tdb->removeTable("invalid_table");
     $this->tdb->removeDatabase();
 }
示例#3
0
 public function testRemoveField()
 {
     $this->tdb->add("test", ["name" => "tim"]);
     $this->tdb->removeField("test", "name");
     $record = $this->tdb->get("test", 1);
     $this->assertEquals(1, $record[0]["id"]);
     $this->assertEquals(false, isset($record[0]["name"]));
 }
示例#4
0
 public function testCreateTableTableInvalidFieldType()
 {
     $this->setExpectedException('TextDb\\Exception\\InvalidArgumentException');
     $this->tdb->createTable("test", [["id", "id"], ["name", "blob", 50]]);
 }