public function testRecordCanBeDeletedById()
 {
     $object = DbQuerries::deleteById("cars", 1);
     $this->assertEquals(1, $object);
     $object1 = DbQuerries::selectAllRecord("cars");
     $this->assertEquals(0, count($object1));
 }
Пример #2
0
 /** 
  * A method to get all the record from a table
  *
  * @return array An array of the model instances
  */
 public static function getAll()
 {
     try {
         $result = DbQuerries::selectAllRecord(static::$table);
         $modelInstance = [];
         // create an array of the model instances
         foreach ($result as $value) {
             $model = new static();
             $modelInstance[] = self::instanceOfModel($result, $model);
         }
     } catch (\Exception $e) {
         echo $e->getMessage();
     }
     return $modelInstance;
 }