public function testRecordCanBeDeletedById() { $object = DbQuerries::deleteById("cars", 1); $this->assertEquals(1, $object); $object1 = DbQuerries::selectAllRecord("cars"); $this->assertEquals(0, count($object1)); }
public static function dropTable($tableName) { $connDetails = array('host' => 'localhost', 'dbname' => 'potatorm', 'user' => 'andela', 'pass' => 'andela'); $connect = DbQuerries::connect($connDetails); try { $connect->exec("DROP TABLE IF EXISTS {$tableName}"); } catch (Exception $e) { echo $e->getMessage(); } }
public function tearDown() { DbQuerries::disconnect(); DbSettingTest::dropTable(Model::getTableName()); }
/** * A method to destroy a record by its id * * @param integer id The id of the record */ public static function destroy($id) { try { $result = DbQuerries::deleteById(static::$table, $id); } catch (\Exception $e) { echo $e->getMessage(); } }