You are here

public function MinkTest::testIsSessionStarted in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/tests/MinkTest.php \Behat\Mink\Tests\MinkTest::testIsSessionStarted()

File

vendor/behat/mink/tests/MinkTest.php, line 148

Class

MinkTest

Namespace

Behat\Mink\Tests

Code

public function testIsSessionStarted() {
  $session_1 = $this
    ->getSessionMock();
  $session_2 = $this
    ->getSessionMock();
  $session_1
    ->expects($this
    ->any())
    ->method('isStarted')
    ->will($this
    ->returnValue(false));
  $session_1
    ->expects($this
    ->never())
    ->method('start');
  $session_2
    ->expects($this
    ->any())
    ->method('isStarted')
    ->will($this
    ->returnValue(true));
  $session_2
    ->expects($this
    ->never())
    ->method('start');
  $this->mink
    ->registerSession('not_started', $session_1);
  $this
    ->assertFalse($this->mink
    ->isSessionStarted('not_started'));
  $this->mink
    ->registerSession('started', $session_2);
  $this
    ->assertTrue($this->mink
    ->isSessionStarted('started'));
  $this
    ->setExpectedException('InvalidArgumentException');
  $this->mink
    ->getSession('not_registered');
}