sensiolabs / BehatPageObjectExtension

MIT License
117 stars 48 forks source link

Remove verify() from $page->open() function #93

Closed RebOOter closed 7 years ago

RebOOter commented 7 years ago

In open() function you have verify() function that check opened URL with current but this is wrong solution. For example: you have http://example.com/url1 that redirect you to http://example.com/url2. You want to check this redirection but with this implementation of open() function this wouldn't work.

All checkers and asserts shouldn't be in action function.

 public function open(array $urlParameters = array())
    {
        $url = $this->getUrl($urlParameters);
        $this->getDriver()->visit($url);
        $this->verify($urlParameters); //this should be removed
        return $this;
    }

I suggest to remove this from open() function.

jakzal commented 7 years ago

You can still override the verify() function to implement custom logic (or no logic). Currently people rely on the behaviour of open() and changing it would break their test suites (the least it will relax some checks).

RebOOter commented 7 years ago

I don't think that it's good solution, but if other people rely on it that will be problem to change it.