public function all() { $model = ReflectionUtils::createNewInstance(static::$forModel); $query = Query::getInstance()->select()->from($model->table())->order(Order::desc("id")); $resultSet = $this->getDatabase()->query($query)->listResult(); return new ResultSet($resultSet); }
public function testShouldProduceSelectStatementWithOrderBy() { $table = "test"; $sql = Query::getInstance()->select("id")->from($table)->order(Order::desc("id"))->build(); $expectedSql = "SELECT id FROM {$table} ORDER BY id DESC"; $this->assertThat($sql, $this->equalTo($expectedSql)); }