當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mink\Session類代碼示例

本文整理匯總了PHP中Behat\Mink\Session的典型用法代碼示例。如果您正苦於以下問題:PHP Session類的具體用法?PHP Session怎麽用?PHP Session使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Session類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: openPage

 public function openPage($url)
 {
     $session = new Session($this->getDriver());
     $session->start();
     $session->visit($url);
     $this->page = $session->getPage();
 }
開發者ID:manasovdan,項目名稱:eTextBookEditor,代碼行數:7,代碼來源:eTextBookDriver.php

示例2: __construct

 /**
  * Initialize element.
  *
  * @param Session $session
  */
 public function __construct(Session $session)
 {
     $this->xpathManipulator = new Manipulator();
     $this->session = $session;
     $this->driver = $session->getDriver();
     $this->selectorsHandler = $session->getSelectorsHandler();
 }
開發者ID:molchanoviv,項目名稱:Mink,代碼行數:12,代碼來源:Element.php

示例3:

 function it_throws_an_exception_if_neither_create_nor_update_key_word_has_been_found(Session $session, SymfonyPageInterface $createPage, SymfonyPageInterface $updatePage, UrlMatcherInterface $urlMatcher)
 {
     $session->getCurrentUrl()->willReturn('https://sylius.com/resource/show');
     $urlMatcher->match('/resource/show')->willReturn(['_route' => 'sylius_resource_show']);
     $createPage->getRouteName()->willReturn('sylius_resource_create');
     $updatePage->getRouteName()->willReturn('sylius_resource_update');
     $this->shouldThrow(\LogicException::class)->during('getCurrentPageWithForm', [[$createPage, $updatePage]]);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:8,代碼來源:CurrentPageResolverSpec.php

示例4:

 function it_loads_base_url_and_sets_a_cookie_if_not_using_kernel_driver_and_driver_is_currently_outside_base_url(Session $minkSession, DriverInterface $driver)
 {
     $minkSession->getDriver()->willReturn($driver);
     $minkSession->getCurrentUrl()->willReturn('http://sylius.org');
     $minkSession->visit('http://localhost:8080/')->shouldBeCalled();
     $minkSession->setCookie('abc', 'def')->shouldBeCalled();
     $this->setCookie('abc', 'def');
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:8,代碼來源:CookieSetterSpec.php

示例5: attachSeleniumSelector

 /**
  * Attaches Selenium selector, that is later used during annotation processing.
  *
  * @param Session $session Mink session.
  *
  * @return self
  */
 protected function attachSeleniumSelector(Session $session)
 {
     $selectors_handler = $session->getSelectorsHandler();
     if (!$selectors_handler->isSelectorRegistered('se')) {
         $selectors_handler->registerSelector('se', new SeleniumSelector($selectors_handler));
     }
     return $session;
 }
開發者ID:virtua-network,項目名稱:qa-tools,代碼行數:15,代碼來源:PageFactory.php

示例6: testBaseUrl

 public function testBaseUrl()
 {
     $client = new Client(require __DIR__ . '/../app.php');
     $driver = new BrowserKitDriver($client, 'http://localhost/foo/');
     $session = new Session($driver);
     $session->visit('http://localhost/foo/index.html');
     $this->assertEquals(200, $session->getStatusCode());
     $this->assertEquals('http://localhost/foo/index.html', $session->getCurrentUrl());
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:9,代碼來源:BaseUrlTest.php

示例7: prepareMinkSessionIfNeeded

 private function prepareMinkSessionIfNeeded()
 {
     if ($this->minkSession->getDriver() instanceof KernelDriver) {
         return;
     }
     if (false !== strpos($this->minkSession->getCurrentUrl(), $this->minkParameters['base_url'])) {
         return;
     }
     $this->minkSession->visit(rtrim($this->minkParameters['base_url'], '/') . '/');
 }
開發者ID:Mozan,項目名稱:Sylius,代碼行數:10,代碼來源:CookieSetter.php

示例8: prepareSessionIfNeeded

 private function prepareSessionIfNeeded()
 {
     if (!$this->minkSession->getDriver() instanceof Selenium2Driver) {
         return;
     }
     if (false !== strpos($this->minkSession->getCurrentUrl(), $this->minkParameters['base_url'])) {
         return;
     }
     $this->homePage->open();
 }
開發者ID:Andretti23,項目名稱:Sylius,代碼行數:10,代碼來源:SecurityContext.php

示例9: logIn

 /**
  * {@inheritdoc}
  */
 public function logIn($email, $providerKey, Session $minkSession)
 {
     $user = $this->userRepository->findOneBy(['username' => $email]);
     if (null === $user) {
         throw new \InvalidArgumentException(sprintf('There is no user with email %s', $email));
     }
     $token = new UsernamePasswordToken($user, $user->getPassword(), $providerKey, $user->getRoles());
     $this->session->set('_security_user', serialize($token));
     $this->session->save();
     $minkSession->setCookie($this->session->getName(), $this->session->getId());
 }
開發者ID:Mangetsu,項目名稱:Sylius,代碼行數:14,代碼來源:SecurityService.php

示例10: array

 function it_does_not_log_user_in_if_user_was_not_found($userRepository, $session, UserInterface $user, Session $minkSession)
 {
     $userRoles = ['ROLE_USER'];
     $userRepository->findOneBy(array('username' => 'sylius@example.com'))->willReturn(null);
     $user->getRoles()->willReturn($userRoles);
     $user->getPassword()->willReturn('xyz');
     $user->serialize()->willReturn('serialized_user');
     $session->set('_security_user', Argument::any())->shouldNotBeCalled();
     $session->save()->shouldNotBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $minkSession->setCookie('MOCKEDSID', 'xyzc123')->shouldNotBeCalled();
     $this->shouldThrow(new \InvalidArgumentException(sprintf('There is no user with email sylius@example.com')))->during('logIn', array('sylius@example.com', 'default', $minkSession));
 }
開發者ID:Spomky,項目名稱:Sylius,代碼行數:14,代碼來源:SecurityServiceSpec.php

示例11: tryRecordTabsOnId

 /**
  * Test record tabs for a particular ID.
  *
  * @param Session $session  Session
  * @param string  $id       ID to load
  * @param bool    $encodeId Should we URL encode the ID?
  *
  * @return void
  */
 protected function tryRecordTabsOnId(Session $session, $id, $encodeId = true)
 {
     $url = $this->getVuFindUrl('/Record/' . ($encodeId ? rawurlencode($id) : $id));
     $session->visit($url);
     $this->assertEquals(200, $session->getStatusCode());
     $page = $session->getPage();
     $staffViewTab = $page->findById('details');
     $this->assertTrue(is_object($staffViewTab));
     $this->assertEquals('Staff View', $staffViewTab->getText());
     $staffViewTab->click();
     $this->assertEquals($url . '#details', $session->getCurrentUrl());
     $staffViewTable = $page->find('css', '#details-tab table.citation');
     $this->assertTrue(is_object($staffViewTable));
     $this->assertEquals('LEADER', substr($staffViewTable->getText(), 0, 6));
 }
開發者ID:joemontibello,項目名稱:vufind,代碼行數:24,代碼來源:RecordTest.php

示例12: stopMinkSession

 /**
  * Shut down the Mink session.
  *
  * @return void
  */
 protected function stopMinkSession()
 {
     if (!empty($this->session)) {
         $this->session->stop();
         $this->session = null;
     }
 }
開發者ID:grharry,項目名稱:vufind,代碼行數:12,代碼來源:MinkTestCase.php

示例13: login

 /**
  * helper method for pages which needs an active login
  *
  * @throws ElementNotFoundException
  *
  * @return void
  */
 protected function login()
 {
     $page = $this->session->getPage();
     $page->fillField('email', 'root');
     $page->fillField('password', 'developer');
     $page->pressButton('Anmelden');
 }
開發者ID:kratenko,項目名稱:oc-server3,代碼行數:14,代碼來源:AbstractFrontendTest.php

示例14: getMessageElement

 /**
  * @return NodeElement
  *
  * @throws ElementNotFoundException
  */
 private function getMessageElement()
 {
     $messageElement = $this->session->getPage()->find('css', self::NOTIFICATION_ELEMENT_CSS);
     if (null === $messageElement) {
         throw new ElementNotFoundException($this->session->getDriver(), 'message element', 'css', self::NOTIFICATION_ELEMENT_CSS);
     }
     return $messageElement;
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:13,代碼來源:NotificationAccessor.php

示例15: getCurrentPageWithForm

 /**
  * {@inheritdoc}
  * 
  * @throws \LogicException
  */
 public function getCurrentPageWithForm(array $pages)
 {
     $routeParameters = $this->urlMatcher->match(parse_url($this->session->getCurrentUrl(), PHP_URL_PATH));
     Assert::allIsInstanceOf($pages, SymfonyPageInterface::class);
     foreach ($pages as $page) {
         if ($routeParameters['_route'] === $page->getRouteName()) {
             return $page;
         }
     }
     throw new \LogicException('Route name could not be matched to provided pages.');
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:16,代碼來源:CurrentPageResolver.php


注:本文中的Behat\Mink\Session類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。