/**
  * Test description.
  *
  * @return void
  */
 public function testSetBrowserFromConfigurationDefault()
 {
     $test_case = $this->getFixture();
     $browser = $this->getBrowser(0);
     $browser_config = array('browserName' => 'safari');
     $this->browserConfigurationFactory->shouldReceive('createBrowserConfiguration')->with($browser_config, $test_case)->once()->andReturn($browser);
     $this->assertSame($test_case, $test_case->setBrowserFromConfiguration($browser_config));
     $this->assertInstanceOf(self::BROWSER_CLASS, $test_case->getBrowser());
 }
 /**
  * Test description.
  *
  * @param string $driver_type Driver.
  *
  * @return void
  * @dataProvider theTestEndedEventDataProvider
  */
 public function testTestEndedEvent($driver_type)
 {
     $test_case = $this->createTestCase('TEST_NAME');
     $api_client = m::mock('aik099\\PHPUnit\\APIClient\\IAPIClient');
     $this->browserConfigurationFactory->shouldReceive('createAPIClient')->with($this->browser)->andReturn($api_client);
     if ($driver_type == 'selenium') {
         $driver = m::mock('\\Behat\\Mink\\Driver\\Selenium2Driver');
         $driver->shouldReceive('getWebDriverSessionId')->once()->andReturn('SID');
         $api_client->shouldReceive('updateStatus')->with('SID', true)->once();
         $test_case->shouldReceive('hasFailed')->once()->andReturn(false);
         // For shared strategy.
     } else {
         $driver = m::mock('\\Behat\\Mink\\Driver\\DriverInterface');
         $this->setExpectedException('RuntimeException');
     }
     $session = m::mock('Behat\\Mink\\Session');
     $session->shouldReceive('getDriver')->once()->andReturn($driver);
     $event_dispatcher = new EventDispatcher();
     $event_dispatcher->addSubscriber($this->browser);
     $test_result = m::mock('PHPUnit_Framework_TestResult');
     $this->eventDispatcher->shouldReceive('removeSubscriber')->with($this->browser)->once();
     $event = $event_dispatcher->dispatch(BrowserTestCase::TEST_ENDED_EVENT, new TestEndedEvent($test_case, $test_result, $session));
     $this->assertInstanceOf('aik099\\PHPUnit\\Event\\TestEndedEvent', $event);
 }
 /**
  * Returns API class for service interaction.
  *
  * @return IAPIClient
  */
 protected function getAPIClient()
 {
     return $this->browserConfigurationFactory->createAPIClient($this);
 }
Example #4
0
 /**
  * Returns browser configuration instance.
  *
  * @param array $browser_config Browser.
  *
  * @return BrowserConfiguration
  */
 protected function createBrowserConfiguration(array $browser_config)
 {
     return $this->_browserConfigurationFactory->createBrowserConfiguration($browser_config, $this);
 }