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)); }
public function testRemoveNonExistingTable() { $this->setExpectedException('\\TextDb\\Exception\\InvalidTableException'); $this->tdb->createDatabase($this->tmpFolder, $this->dbName); $this->tdb->removeTable("invalid_table"); $this->tdb->removeDatabase(); }
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"])); }
public function testCreateTableTableInvalidFieldType() { $this->setExpectedException('TextDb\\Exception\\InvalidArgumentException'); $this->tdb->createTable("test", [["id", "id"], ["name", "blob", 50]]); }