protected function getContextMock() { $pageMock = $this->getMockBuilder('Behat\\Mink\\Element\\DocumentElement')->disableOriginalConstructor()->setMethods(array('find'))->getMock(); $sessionMock = $this->getMockBuilder('Behat\\Mink\\Session')->setConstructorArgs(array($this->getMock('Behat\\Mink\\Driver\\DriverInterface'), $this->getMock('Behat\\Mink\\Selector\\SelectorsHandler')))->setMethods(array('getPage'))->getMock(); $sessionMock->expects($this->any())->method('getPage')->will($this->returnValue($pageMock)); $mink = new Mink(array('default' => $sessionMock)); $mink->setDefaultSessionName('default'); $context = new SilverStripeContext(array()); $context->setMink($mink); return $context; }
public function setMinkParameters(array $parameters) { parent::setMinkParameters($parameters); if (isset($parameters['files_path'])) { $this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']); } }
/** * Initializes context. * Every scenario gets it's own context object. * * @param array $parameters context parameters (set them up through behat.yml) */ public function __construct(array $parameters) { $this->useContext('BasicContext', new BasicContext($parameters)); $this->useContext('LoginContext', new LoginContext($parameters)); $this->useContext('CmsFormsContext', new CmsFormsContext($parameters)); $this->useContext('CmsUiContext', new CmsUiContext($parameters)); $this->useContext('EmailContext', new EmailContext($parameters)); parent::__construct($parameters); }
/** * "Shares" the database with web requests, see * {@link DemoFakeManagerControllerExtension} */ public function getTestSessionState() { return array_merge(parent::getTestSessionState(), array('useFakeManager' => true, 'importDatabasePath' => BASE_PATH . '/mysite/tests/fixtures/SS_mysite.sql', 'requireDefaultRecords' => false, 'fakeDatabasePath' => $this->getFakeDatabasePath())); }