예제 #1
0
 public function __construct($config, $options)
 {
     parent::__construct($config, $options);
     // Set default path for PhantomJS to "vendor/bin/phantomjs" for if it was installed via composer
     if (!isset($this->config['path'])) {
         $this->config['path'] = "vendor/bin/phantomjs";
     }
     // If a directory was provided for the path, use old method of appending PhantomJS
     if (is_dir(realpath($this->config['path']))) {
         // Show warning that this is being deprecated
         $this->writeln("\r\n");
         $this->writeln("WARNING: The PhantomJS path for Phantoman is set to a directory, this is being deprecated in the future. Please update your Phantoman configuration to be the full path to PhantomJS.");
         $this->config['path'] .= '/phantomjs';
     }
     // Add .exe extension if running on the windows
     if ($this->isWindows() && file_exists(realpath($this->config['path'] . '.exe'))) {
         $this->config['path'] .= '.exe';
     }
     // Set default WebDriver port
     if (!isset($this->config['port'])) {
         $this->config['port'] = 4444;
     }
     // Set default debug mode
     if (!isset($this->config['debug'])) {
         $this->config['debug'] = false;
     }
     $this->startServer();
     $resource = $this->resource;
     register_shutdown_function(function () use($resource) {
         if (is_resource($resource)) {
             proc_terminate($resource);
         }
     });
 }
 /**
  * {@inheritdoc}
  */
 public function _initialize()
 {
     $this->container = new Container();
     $this->logger = new Logger('tests', $this->resolveHandlers());
     $this->message = !empty($this->config['message']) ? $this->config['message'] : $this->defaultMessage;
     parent::_initialize();
 }
예제 #3
0
 /**
  * @param array $config
  * @param array $options
  */
 public function __construct($config, $options)
 {
     parent::__construct($config, $options);
     if (isset($config['warningTimeLimit']) && $config['warningTimeLimit'] > 0) {
         $this->warningTimeLimit = (double) $config['warningTimeLimit'];
     }
     if (isset($config['errorTimeLimit']) && $config['errorTimeLimit'] > 0) {
         $this->errorTimeLimit = (double) $config['errorTimeLimit'];
     }
 }
 public function _initialize()
 {
     parent::_initialize();
     Annotation\AnnotationProvider::registerAnnotationNamespaces();
     $outputDirectory = $this->getOutputDirectory();
     $deletePreviousResults = $this->tryGetOption(DELETE_PREVIOUS_RESULTS_PARAMETER, false);
     $this->prepareOutputDirectory($outputDirectory, $deletePreviousResults);
     if (is_null(Model\Provider::getOutputDirectory())) {
         Model\Provider::setOutputDirectory($outputDirectory);
     }
 }
 /**
  * Class constructor.
  *
  * @param array              $config
  * @param array              $options
  * @param WireMockDownloader $downloader       optional WireMockDownloader object
  * @param WireMockProcess    $process          optional WireMockProcess object
  * @param WireMockArguments  $argumentsManager optional WireMockArguments object
  */
 public function __construct(array $config, array $options, WireMockDownloader $downloader = null, WireMockProcess $process = null, WireMockArguments $argumentsManager = null)
 {
     parent::__construct($config, $options);
     $this->initWireMockDownloader($downloader);
     $this->initWireMockProcess($process);
     $this->initWireMockArgumentsManager($argumentsManager);
     $this->config = $this->argumentsManager->sanitize($this->config);
     echo "Starting local wiremock" . PHP_EOL;
     $this->process->start($this->getJarPath(), $this->config['logs-path'], $this->mapConfigToWireMockArguments($this->config));
     sleep($this->config['start-delay']);
 }
 public function __construct($config, $options)
 {
     if (version_compare(PHP_VERSION, '5.4', '<')) {
         throw new ExtensionException($this, 'Requires PHP built-in web server, available since PHP 5.4.0.');
     }
     parent::__construct($config, $options);
     $this->orgConfig = $config;
     $this->validateConfig();
     if (!array_key_exists('startDelay', $this->config) || !(is_int($this->config['startDelay']) || ctype_digit($this->config['startDelay']))) {
         $this->config['startDelay'] = 1;
     }
 }
 /**
  * {@inheritDoc}
  *
  * Starts the connection
  */
 public function _reconfigure($config = array())
 {
     parent::_reconfigure($config);
     if (!isset($this->config['username'])) {
         throw new \Exception("Sauce Connect Extension requires a username.");
     }
     if (!isset($this->config['accesskey'])) {
         throw new \Exception("Sauce Connect Extension requires a accesskey.");
     }
     $connect = __DIR__ . '/../../../bin/sauce_connect';
     if (!file_exists($connect)) {
         $connect = __DIR__ . '/../../../../bin/sauce_connect';
     }
     if (!file_exists($connect)) {
         throw new \Exception("Couldnt find the bin directory... Make sure its in ./bin or ./vendor/bin/");
     }
     $processBuilder = new ProcessBuilder([$connect]);
     $processBuilder->addEnvironmentVariables(['SAUCE_USERNAME' => $this->config['username'], 'SAUCE_ACCESS_KEY' => $this->config['accesskey']]);
     $timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 60;
     $this->process = $processBuilder->getProcess();
     $this->process->setTimeout(0);
     $this->process->start(function ($type, $buffer) {
         $buffer = explode("\n", $buffer);
         foreach ($buffer as $line) {
             if (strpos($line, 'Press any key to see more output') === false) {
                 file_put_contents(codecept_output_dir() . 'sauce_connect.log', $line . "\n", FILE_APPEND);
             }
         }
     });
     $timer = 0;
     $connected = false;
     $this->writeln(["", "----------------------------------------------------------------------------", "Attempting to connect to SauceLabs. Waiting {$timeout} seconds."]);
     while ($this->process->isRunning() && $timer < $timeout) {
         $output = $this->process->getOutput();
         if (strpos($output, 'Connected! You may start your tests.') !== false) {
             $connected = true;
             break;
         }
         sleep(1);
         $timer++;
         if ($timer % 5 === 0) {
             $this->write('.');
         }
     }
     if (false === $connected) {
         $this->process->stop();
         throw new \Exception(sprintf("Could not start tunnel. Check %ssauce_connect.log for more information.", codecept_output_dir()));
     }
     $this->writeln(["", "Connected to SauceLabs", "----------------------------------------------------------------------------", ""]);
 }
 /**
  * Extra annotations to ignore in addition to standard PHPUnit annotations.
  * 
  * @param array $ignoredAnnotations
  */
 public function _initialize(array $ignoredAnnotations = [])
 {
     parent::_initialize();
     Annotation\AnnotationProvider::registerAnnotationNamespaces();
     // Add standard PHPUnit annotations
     Annotation\AnnotationProvider::addIgnoredAnnotations($this->ignoredAnnotations);
     // Add custom ignored annotations
     Annotation\AnnotationProvider::addIgnoredAnnotations($ignoredAnnotations);
     $outputDirectory = $this->getOutputDirectory();
     $deletePreviousResults = $this->tryGetOption(DELETE_PREVIOUS_RESULTS_PARAMETER, false);
     $this->prepareOutputDirectory($outputDirectory, $deletePreviousResults);
     if (is_null(Model\Provider::getOutputDirectory())) {
         Model\Provider::setOutputDirectory($outputDirectory);
     }
 }
 public function __construct($config, $options)
 {
     if (version_compare(PHP_VERSION, '5.4', '<')) {
         throw new ExtensionException($this, 'Requires PHP built-in web server, available since PHP 5.4.0.');
     }
     parent::__construct($config, $options);
     $this->validateConfig();
     if (!array_key_exists('startDelay', $this->config) || !(is_int($this->config['startDelay']) || ctype_digit($this->config['startDelay']))) {
         $this->config['startDelay'] = 1;
     }
     $this->startServer();
     $resource = $this->resource;
     register_shutdown_function(function () use($resource) {
         if (is_resource($resource)) {
             proc_terminate($resource);
         }
     });
 }
예제 #10
0
 public function __construct($config, $options)
 {
     parent::__construct($config, $options);
     // Set default path for PhantomJS to "vendor/bin" for if it was installed via composer
     if (!isset($this->config['path'])) {
         $this->config['path'] = "vendor/bin";
     }
     // Set default WebDriver port
     if (!isset($this->config['port'])) {
         $this->config['port'] = 4444;
     }
     $this->startServer();
     $resource = $this->resource;
     register_shutdown_function(function () use($resource) {
         if (is_resource($resource)) {
             proc_terminate($resource);
         }
     });
 }
 /**
  *  Construct a DrushRunserver instance.
  */
 public function __construct($config, $options)
 {
     // ToDo: Add in a config option to allow people to override this should they wish to try playing with PHP 5.3/CGI.
     if (version_compare(PHP_VERSION, '5.4', '<')) {
         throw new ExtensionException($this, 'Requires PHP 5.4 or above.');
     }
     parent::__construct($config, $options);
     // Allow a configurable path to Drush in case it's not installed system-wide.
     if (isset($this->config['drushBinary']) && !is_null($this->config['drushBinary'])) {
         $this->drushBinary = $this->config['drushBinary'];
     }
     // Get the sleep timeout from the config if it's available.
     $this->sleep = isset($this->config['sleep']) ? $this->config['sleep'] : 2;
     $this->startServer();
     $resource = $this->resource;
     register_shutdown_function(function () use($resource) {
         if (is_resource($resource)) {
             proc_terminate($resource);
         }
     });
 }
예제 #12
0
 public function __construct($config, $options)
 {
     parent::__construct($config, $options);
     $this->propelLoadApplication();
     $this->propelOutput = new ConsoleOutput(ConsoleOutput::VERBOSITY_DEBUG);
 }
 public function __construct($config, $options)
 {
     parent::__construct($config, $options);
 }
예제 #14
0
 public function __construct(array $config, array $options)
 {
     parent::__construct(array_merge($this->defaults, $config), $options);
     $this->diManager = new DependencyInjectionService();
     $this->startHttpMock();
 }