コード例 #1
0
 /**
  * Creates suite for testing.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->_manager = m::mock('aik099\\PHPUnit\\Session\\SessionStrategyManager');
     $this->_browserFactory = m::mock('aik099\\PHPUnit\\BrowserConfiguration\\IBrowserConfigurationFactory');
     $this->_remoteCoverageHelper = m::mock('aik099\\PHPUnit\\RemoteCoverage\\RemoteCoverageHelper');
     $this->_factory = new TestSuiteFactory($this->_manager, $this->_browserFactory, $this->_remoteCoverageHelper);
     $this->_factory->setApplication($this->application);
 }
コード例 #2
0
ファイル: DIContainer.php プロジェクト: aik099/phpunit-mink
 /**
  * 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['browser_configuration_factory'] = function ($c) {
         $browser_configuration_factory = new BrowserConfigurationFactory();
         $browser_configuration_factory->register(new BrowserConfiguration($c['event_dispatcher']));
         $browser_configuration_factory->register(new SauceLabsBrowserConfiguration($c['event_dispatcher'], $browser_configuration_factory));
         $browser_configuration_factory->register(new BrowserStackBrowserConfiguration($c['event_dispatcher'], $browser_configuration_factory));
         return $browser_configuration_factory;
     };
 }