/**
  * Hook, called from "BrowserTestCase::setUp" method.
  *
  * @param TestEvent $event Test event.
  *
  * @return void
  */
 public function onTestSetup(TestEvent $event)
 {
     if (!$event->validateSubscriber($this->getTestCase())) {
         return;
     }
     parent::onTestSetup($event);
     $desired_capabilities = $this->getDesiredCapabilities();
     if (getenv('PHPUNIT_MINK_TUNNEL_ID')) {
         $desired_capabilities['tunnel-identifier'] = getenv('PHPUNIT_MINK_TUNNEL_ID');
     }
     $this->setDesiredCapabilities($desired_capabilities);
 }
 /**
  * Verify how the API calls were made.
  *
  * @param TestEvent $event Event.
  *
  * @return void
  */
 public function verifyRemoteAPICalls(TestEvent $event)
 {
     if (!$event->validateSubscriber($this)) {
         return;
     }
     $test_case = $event->getTestCase();
     $test_name = $test_case->getName(false);
     if (!isset($this->_sessionIds[$test_name])) {
         return;
     }
     $browser = $this->getBrowser();
     if ($browser instanceof ApiBrowserConfiguration) {
         $api_client = $browser->getAPIClient();
         $session_info = $api_client->getInfo($this->_sessionIds[$test_name]);
         $this->assertEquals(get_class($test_case) . '::' . $test_name, $session_info['name']);
         if ($browser instanceof SauceLabsBrowserConfiguration) {
             $passed_mapping = array('testSuccess' => true, 'testFailure' => false);
             $this->assertSame($passed_mapping[$test_name], $session_info['passed']);
         } elseif ($browser instanceof BrowserStackBrowserConfiguration) {
             $passed_mapping = array('testSuccess' => 'done', 'testFailure' => 'error');
             $this->assertSame($passed_mapping[$test_name], $session_info['status']);
         }
     }
 }
 /**
  * Hook, called from "BrowserTestCase::setUp" method.
  *
  * @param TestEvent $event Test event.
  *
  * @return void
  */
 public function onTestSetup(TestEvent $event)
 {
     if (!$event->validateSubscriber($this->getTestCase())) {
         return;
     }
     // Place code here.
 }
 /**
  * Hook, called from "BrowserTestCase::setUp" method.
  *
  * @param TestEvent $event Test event.
  *
  * @return void
  */
 public function onTestSetup(TestEvent $event)
 {
     if (!$event->validateSubscriber($this->getTestCase())) {
         return;
     }
     parent::onTestSetup($event);
     $desired_capabilities = $this->getDesiredCapabilities();
     $desired_capabilities[self::NAME_CAPABILITY] = $this->getJobName($event->getTestCase());
     if (getenv('BUILD_NUMBER')) {
         $desired_capabilities[self::BUILD_NUMBER_CAPABILITY] = getenv('BUILD_NUMBER');
         // Jenkins.
     } elseif (getenv('TRAVIS_BUILD_NUMBER')) {
         $desired_capabilities[self::BUILD_NUMBER_CAPABILITY] = getenv('TRAVIS_BUILD_NUMBER');
     }
     $this->setDesiredCapabilities($desired_capabilities);
 }