/**
  * Expects a factory call.
  *
  * @param string $service_id      Service ID.
  * @param mixed  $returned_object Object to return.
  *
  * @return void
  */
 protected function expectFactoryCall($service_id, $returned_object)
 {
     if (is_array($returned_object)) {
         $this->application->shouldReceive('getObject')->with($service_id)->andReturnValues($returned_object);
     } else {
         $this->application->shouldReceive('getObject')->with($service_id)->andReturn($returned_object);
     }
 }
 /**
  * Creates specified session strategy.
  *
  * @param string $strategy_type Session strategy type.
  *
  * @return ISessionStrategy
  * @throws \InvalidArgumentException When session strategy type is invalid.
  */
 public function createStrategy($strategy_type)
 {
     if ($strategy_type == ISessionStrategyFactory::TYPE_ISOLATED) {
         return $this->application->getObject('isolated_session_strategy');
     } elseif ($strategy_type == ISessionStrategyFactory::TYPE_SHARED) {
         return $this->application->getObject('shared_session_strategy');
     }
     throw new \InvalidArgumentException('Incorrect session strategy type');
 }
示例#3
0
 /**
  * Creates browser suite.
  *
  * @param string $class_name Descendant of TestCase class.
  * @param array  $browser    Browser configuration.
  *
  * @return BrowserTestSuite
  */
 private function _createBrowserSuite($class_name, array $browser)
 {
     /** @var BrowserTestSuite $suite */
     $suite = $this->application->getObject('browser_test_suite');
     $suite->setName($class_name . ': ' . $suite->nameFromBrowser($browser));
     $suite->addTestMethods($class_name);
     $suite->setTestDependencies($this->_sessionStrategyManager, $this->_browserConfigurationFactory, $this->_remoteCoverageHelper);
     $suite->setBrowserFromConfiguration($browser);
     return $suite;
 }
示例#4
0
 /**
  * Test description.
  *
  * @return void
  * @expectedException \InvalidArgumentException
  */
 public function testReplaceObjectFailure()
 {
     $this->_application->replaceObject('bad_service', function () {
     });
 }
示例#5
0
 /**
  * Creates test suite for usage with Mink.
  *
  * @param string $class_name Test case class name.
  *
  * @return RegularTestSuite
  */
 public static function suite($class_name)
 {
     $application = Application::getInstance();
     return $application->getTestSuiteFactory()->createSuiteFromTestCase($class_name);
 }