/**
  * Test description.
  *
  * @return void
  * @expectedException \InvalidArgumentException
  */
 public function testRegisterFailure()
 {
     $browser_configuration = $this->_createBrowserConfiguration('new-one');
     $this->_factory->register($browser_configuration);
     $this->_factory->register($browser_configuration);
 }
Example #2
0
 /**
  * Instantiate the container.
  *
  * Objects and parameters can be passed as argument to the constructor.
  *
  * @param array $values The parameters or objects.
  */
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this['event_dispatcher'] = function () {
         return new EventDispatcher();
     };
     $this['session_factory'] = function () {
         return new SessionFactory();
     };
     $this['session_strategy_factory'] = function ($c) {
         $session_strategy_factory = new SessionStrategyFactory();
         $session_strategy_factory->setApplication($c['application']);
         return $session_strategy_factory;
     };
     $this['session_strategy_manager'] = function ($c) {
         return new SessionStrategyManager($c['session_strategy_factory']);
     };
     $this['isolated_session_strategy'] = $this->factory(function ($c) {
         $session_strategy = new IsolatedSessionStrategy($c['session_factory']);
         $session_strategy->setEventDispatcher($c['event_dispatcher']);
         return $session_strategy;
     });
     $this['shared_session_strategy'] = $this->factory(function ($c) {
         $session_strategy = new SharedSessionStrategy($c['isolated_session_strategy']);
         $session_strategy->setEventDispatcher($c['event_dispatcher']);
         return $session_strategy;
     });
     $this['remote_url'] = function () {
         return new RemoteUrl();
     };
     $this['remote_coverage_helper'] = function ($c) {
         return new RemoteCoverageHelper($c['remote_url']);
     };
     $this['test_suite_factory'] = function ($c) {
         $test_suite_factory = new TestSuiteFactory($c['session_strategy_manager'], $c['browser_configuration_factory'], $c['remote_coverage_helper']);
         $test_suite_factory->setApplication($c['application']);
         return $test_suite_factory;
     };
     $this['regular_test_suite'] = $this->factory(function ($c) {
         $test_suite = new RegularTestSuite();
         $test_suite->setEventDispatcher($c['event_dispatcher']);
         return $test_suite;
     });
     $this['browser_test_suite'] = $this->factory(function ($c) {
         $test_suite = new BrowserTestSuite();
         $test_suite->setEventDispatcher($c['event_dispatcher']);
         return $test_suite;
     });
     $this['driver_factory_registry'] = function () {
         $registry = new DriverFactoryRegistry();
         $registry->add(new Selenium2DriverFactory());
         $registry->add(new SahiDriverFactory());
         $registry->add(new GoutteDriverFactory());
         $registry->add(new ZombieDriverFactory());
         return $registry;
     };
     $this['browser_configuration_factory'] = function ($c) {
         $browser_configuration_factory = new BrowserConfigurationFactory();
         $browser_configuration_factory->register(new BrowserConfiguration($c['event_dispatcher'], $c['driver_factory_registry']));
         $browser_configuration_factory->register(new SauceLabsBrowserConfiguration($c['event_dispatcher'], $c['driver_factory_registry']));
         $browser_configuration_factory->register(new BrowserStackBrowserConfiguration($c['event_dispatcher'], $c['driver_factory_registry']));
         return $browser_configuration_factory;
     };
 }
 /**
  * Test description.
  *
  * @return void
  * @expectedException \LogicException
  */
 public function testCreateAPIClientFailure()
 {
     $browser = new BrowserConfiguration($this->eventDispatcher);
     $this->_factory->createAPIClient($browser);
 }