public function testResetSessions() { $session1 = $this->getSessionMock(); $session1->expects($this->once())->method('isStarted')->will($this->returnValue(false)); $session1->expects($this->never())->method('reset'); $session2 = $this->getSessionMock(); $session2->expects($this->once())->method('isStarted')->will($this->returnValue(true)); $session2->expects($this->once())->method('reset'); $this->mink->registerSession('not started', $session1); $this->mink->registerSession('started', $session2); $this->mink->resetSessions(); }
protected function tearDown() { if (null !== self::$mink) { self::$mink->resetSessions(); } }
$this->suite()->symfony = $kernel; return $chain->next(); }); Filter::register('mink.register', function ($chain) { $default_browser = getenv('MINK_DEFAULT_BROWSER') !== false ? getenv('MINK_DEFAULT_BROWSER') : 'chrome'; $firefox_location = getenv('SELENIUM_FIREFOX_HOST') !== false ? getenv('SELENIUM_FIREFOX_HOST') : 'localhost'; $chrome_location = getenv('SELENIUM_CHROME_HOST') !== false ? getenv('SELENIUM_CHROME_HOST') : 'localhost'; $firefox_selenium_host = "http://{$firefox_location}:4444/wd/hub"; $chrome_selenium_host = "http://{$chrome_location}:4444/wd/hub"; $mink = new Mink(['firefox' => new Session(new Selenium2Driver('firefox', ['browserName' => 'firefox'], $firefox_selenium_host)), 'chrome' => new Session(new Selenium2Driver('chrome', ['browserName' => 'chrome'], $chrome_selenium_host))]); $mink->setDefaultSessionName($default_browser); /** @var Suite $root */ $root = $this->suite(); $root->mink = $mink; $root->beforeEach(function () use($mink) { $mink->resetSessions(); }); $root->after(function () use($mink) { $mink->stopSessions(); }); return $chain->next(); }); Filter::register('specs.prepare', function ($chain) { $callback = (require_once __DIR__ . '/prepare.php'); /** @var Suite $root */ $root = $this->suite(); $root->before($callback); return $chain->next(); }); Filter::apply($this, 'run', 'mockery.register.close'); Filter::apply($this, 'run', 'mink.register');