Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Feature test multiple requests failure #27

@saimonas7

Description

@saimonas7

During feature test, when I'm trying to send multiple requests to show function (BaseApiController), all requests after first one fails in findById function (BaseApiRepository). I figured out that query builder instance is not destroyed after first request and where clauses remains from previous requests. For example:

// First request
"select * from "pages" where "pages"."id" = ? limit 1"
// Second request
"select * from "pages" where "pages"."id" = ? and "pages"."id" = ? limit 1"
// Third request
"select * from "pages" where "pages"."id" = ? and "pages"."id" = ? and "pages"."id" = ? limit 1"

One of possible solutions would be to update initQuery function in BaseApiRepository and unset Query Builder if it's set. E.g.

    public function initQuery()
    {
        if (isset($this->query)) {
            unset($this->query);
        }
        $this->query = $this->model->newQuery();
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions