-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only start session if the session has not been started before #732
Changes from 4 commits
a78efd0
93087a2
d3a2a1b
cc3df3d
900e11a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,14 +57,32 @@ public function testIsStarted() | |
$this->assertTrue($this->session->isStarted()); | ||
} | ||
|
||
public function testStart() | ||
public function testStartWithoutRunningSession() | ||
{ | ||
$this->driver | ||
->expects($this->once()) | ||
->method('isStarted') | ||
->willReturn(false); | ||
|
||
$this->driver->expects($this->once()) | ||
->method('start'); | ||
|
||
$this->session->start(); | ||
} | ||
|
||
public function testStartWithRunningSession() | ||
{ | ||
$this->driver | ||
->expects($this->once()) | ||
->method('isStarted') | ||
->willReturn(true); | ||
|
||
$this->driver->expects($this->never()) | ||
->method('start'); | ||
|
||
$this->session->start(); | ||
} | ||
|
||
public function testStop() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test must not be removed. We still need to cover the case of calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually the discussion from https://github.com/minkphp/Mink/pull/733/files#r99773293 is meant to happen on this PR instead. |
||
{ | ||
$this->driver->expects($this->once()) | ||
|
@@ -83,34 +101,10 @@ public function testRestart() | |
$this->session->restart(); | ||
} | ||
|
||
public function testVisitWithoutRunningSession() | ||
{ | ||
$this->driver | ||
->expects($this->once()) | ||
->method('isStarted') | ||
->willReturn(false); | ||
|
||
$this->driver | ||
->expects($this->once()) | ||
->method('start'); | ||
|
||
$this->driver | ||
->expects($this->once()) | ||
->method('visit') | ||
->with($url = 'some_url'); | ||
|
||
$this->session->visit($url); | ||
} | ||
|
||
public function testVisitWithRunningSession() | ||
public function testVisit() | ||
{ | ||
$this->driver | ||
->expects($this->once()) | ||
->method('isStarted') | ||
->willReturn(true); | ||
|
||
$this->driver | ||
->expects($this->never()) | ||
->method('start'); | ||
|
||
$this->driver | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to allow this, we must add new tests in the driver testsuite calling these methods before visiting a page, to ensure it actually works in all drivers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, this does not seem related to this PR, but to #733
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, that is my bad. Where would you add the tests? Looking at the CoreDriverTest and the Tests in the Selenium driver I could not see any tests on e.g. the visit method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved that to #733.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the driver testsuite lives in https://github.com/minkphp/driver-testsuite and is a dev dependency in all drivers repositories, to share the same testsuite in all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I was scanning the testsuite, I could not find a test where the autostart is tested e.g. for the visit method by grepping te repository. Do you know if there is anything in this regard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allowing to call these methods without visiting a page is not related to auto-starting. It is a different feature (and this is what you need to test).
Auto-starting is not tested in the driver testsuite, because drivers don't care about it. It is implemented at the session level. But being able to resize before visiting is something that drivers themselves must support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay. So what do you think about: minkphp/driver-testsuite#10