Example #1
0
 /**
  * @param \Codeception\Lib\ModuleContainer $moduleContainer
  * @param null $config
  */
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     parent::__construct($moduleContainer, $config);
     if (!empty($config['enabled'])) {
         $this->generateTransferObjects();
     }
 }
Example #2
0
 /**
  * @param \Codeception\TestCase $test
  * @param bool $fail
  *
  * @return void
  */
 public function _failed(TestCase $test, $fail)
 {
     parent::_failed($test, $fail);
     if (session_status() === PHP_SESSION_ACTIVE) {
         session_destroy();
     }
 }
Example #3
0
 public function _initialize()
 {
     if (!function_exists('xmlrpc_encode_request')) {
         throw new ModuleRequireException(__CLASS__, "XMLRPC module requires installed php_xmlrpc extension");
     }
     parent::_initialize();
 }
Example #4
0
 /**
  * Provide and override for the config settings and allow custom settings depending on the service being used.
  */
 protected function validateConfig()
 {
     $this->IMDriver = $this->createIMDriver();
     $this->requiredFields = $this->IMDriver->getRequiredConfig();
     $this->config = array_merge($this->IMDriver->getDefaultConfig(), $this->config);
     parent::validateConfig();
 }
Example #5
0
 /**
  * @param \Codeception\Lib\ModuleContainer $moduleContainer
  * @param array|null $config
  */
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     parent::__construct($moduleContainer, $config);
     if (!empty($config['enabled'])) {
         $this->initPropel();
     }
 }
Example #6
0
 public function _before(\Codeception\TestCase $test)
 {
     parent::_before($test);
     /////////////////////////////////////
     // initialize your database here
     /////////////////////////////////////
 }
Example #7
0
 /**
  * @param \Codeception\Lib\ModuleContainer $moduleContainer
  * @param null $config
  */
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     parent::__construct($moduleContainer, $config);
     if (isset($this->config['enabled']) && $this->config['enabled']) {
         $this->copyBundleConfigurationFiles();
         $this->generateConfigDefaultFile();
     }
 }
Example #8
0
 /**
  * @param \Codeception\TestCase $test
  * @param bool $fail
  *
  * @return void
  */
 public function _failed(TestCase $test, $fail)
 {
     parent::_failed($test, $fail);
     Propel::getWriteConnection('zed')->rollBack();
     if (session_status() === PHP_SESSION_ACTIVE) {
         session_destroy();
     }
 }
 public function __construct($config = null)
 {
     // terminology: see = isXyz => true/false, have = create, grab = get => data
     if (!isset($config['hosts'])) {
         throw new \Exception('please configure hosts for ElasticSearch codeception module');
     }
     if (isset($config['hosts']) && !is_array($config['hosts'])) {
         $config['hosts'] = array($config['hosts']);
     }
     $this->config = (array) $config;
     parent::__construct();
 }
 /**
  * Ensure the class specified is valid.
  *
  * @see \Codeception\Module::validateConfig()
  * @throws \Codeception\Exception\ModuleConfig
  */
 protected function validateConfig()
 {
     parent::validateConfig();
     $class = $this->config['class'];
     if (!class_exists($class)) {
         throw new \Codeception\Exception\ModuleConfig("DrupalVariable", "Invalid config. Class '{$class}' does not exist");
     }
     $interface = "Codeception\\Module\\Drupal\\Variable\\VariableStorage\\StorageInterface";
     if (!in_array($interface, class_implements($class))) {
         throw new \Codeception\Exception\ModuleConfig("DrupalVariable", "Invalid config. Class '{$class}' must implement '{$interface}'");
     }
 }
 public function _after(TestCase $test)
 {
     foreach ($this->insertedIds as $id) {
         try {
             $this->auth0Api->users->delete($id);
         } catch (\Exception $e) {
             $this->debug(sprintf('id: "%s" not removed: "%s"', $id, $e->__toString()));
         }
     }
     $this->insertedIds = [];
     parent::_after($test);
 }
 /**
  * Drupal8Module constructor.
  */
 public function __construct(ModuleContainer $container, $config = null)
 {
     $this->config = array_merge(['drupal_root' => Configuration::projectDir() . 'web', 'site_path' => 'sites/test', 'create_users' => true, 'destroy_users' => true, 'test_user_pass' => 'test'], (array) $config);
     // Bootstrap a bare minimum Kernel so we can interact with Drupal.
     $autoloader = (require $this->config['drupal_root'] . '/autoload.php');
     $kernel = new TestDrupalKernel('prod', $autoloader, $this->config['drupal_root']);
     $kernel->bootTestEnvironment($this->config['site_path']);
     // Allow for setting some basic info output.
     $this->output = new ConsoleOutput();
     // Get our role definitions as we use them a lot.
     $this->roles = Role::loadMultiple();
     parent::__construct($container);
 }
 /**
  * @param ModuleContainer $moduleContainer
  * @param null            $config
  */
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     parent::__construct($moduleContainer, $config);
     $this->fs = $this->getModule('Filesystem');
     $packageDir = dirname(dirname(dirname(dirname(__FILE__))));
     $this->projectDirTemplate = "{$packageDir}/tests/_data/project_template";
     $this->projectRoot = "{$packageDir}/{$config['test_path']}";
     // Set the project root for the NpmPackage module
     if ($moduleContainer->hasModule('\\CubicMushroom\\Tools\\ProjectToolbelt\\Codeception\\Helper\\NpmPackage')) {
         /** @var JsonFile $npmPackageModule */
         $npmPackageModule = $moduleContainer->getModule('\\CubicMushroom\\Tools\\ProjectToolbelt\\Codeception\\Helper\\NpmPackage');
         $npmPackageModule->_reconfigure([JsonFile::CONFIG_PROJECT_ROOT => $this->projectRoot]);
     }
 }
 /**
  * @param ModuleContainer $moduleContainer
  * @param array           $config
  *
  * @throws ModuleRequireException if required modules are not available
  */
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     parent::__construct($moduleContainer, $config);
     $missingModules = [];
     foreach ($this->requiredModules as $module) {
         if (!$moduleContainer->hasModule($module)) {
             $missingModules[] = $module;
         }
     }
     if (!empty($missingModules)) {
         throw new ModuleRequireException('Missing the following modules, required by the NpmPackage module are missing...', implode(', ', $missingModules));
     }
     $this->fs = $moduleContainer->getModule('Filesystem');
 }
 /**
  * {@inheritdoc}
  */
 public function __construct($config = null)
 {
     parent::__construct($config);
     \Yii::import('system.cli.commands.MigrateCommand');
     $configFile = \Yii::getPathOfAlias('application.config.console') . '.php';
     $config = (include $configFile);
     $this->_command = new \MigrateCommand(null, null);
     foreach ($config['commandMap']['migrate'] as $option => $value) {
         if ($option === 'class') {
             continue;
         } else {
             if ($option === 'migrationPath') {
                 $this->_command->{$option} = \Yii::getPathOfAlias($value);
             } else {
                 $this->_command->{$option} = $value;
             }
         }
     }
     $this->_command->interactive = false;
     static::$_instance = $this;
 }
 public function __construct()
 {
     parent::__construct();
     self::$baseMockPath = __DIR__ . '/mock/';
 }
 /**
  * @param ModuleContainer $container
  * @param null $config
  */
 public function __construct(ModuleContainer $container, $config = null)
 {
     parent::__construct($container, $config);
 }
 /**
  * Failed test case hook
  *
  * @param TestCase $test test
  * @param mixed    $fail fail
  *
  * @return void
  */
 public function _failed(TestCase $test, $fail)
 {
     parent::_failed($test, $fail);
     $this->module->_failed($test, $fail);
 }
 /**
  * {@inheritDoc}
  * @see \Codeception\Module::_after()
  */
 public function _after(TestCase $testCase)
 {
     parent::_after($testCase);
     $this->throwExceptionOnHttpMockError();
     $this->diManager->get('httpMockServer')->clean();
 }
Example #20
0
 public function __construct(ModuleContainer $moduleContainer, $config, WP $wp = null)
 {
     parent::__construct($moduleContainer, $config);
     $this->wp = $wp ? $wp : new WP();
 }
 /**
  * Create an object from VisualCeption Class
  *
  * @param array $config
  * @return result
  */
 public function __construct($config)
 {
     $result = parent::__construct($config);
     $this->init();
     return $result;
 }
Example #22
0
 public function _after(\Codeception\TestCase $test)
 {
     $this->populated = false;
     $this->removeInserted();
     parent::_after($test);
 }
Example #23
0
 /**
  * Fails the test with message.
  *
  * @param $message
  */
 public function fail($message)
 {
     parent::fail($message);
 }
Example #24
0
 public function _after(\Codeception\TestCase $test)
 {
     $this->populated = false;
     $this->removeInserted();
     if ($this->config['reconnect']) {
         $this->disconnect();
     }
     parent::_after($test);
 }
 public function _afterSuite()
 {
     $this->debug(__CLASS__ . '::' . __FUNCTION__ . '()');
     foreach ($this->suite_cleanup_actions as $cleanup_action) {
         $this->debugSection('cleanup(after-suite)', $cleanup_action->getDefinition());
         call_user_func($cleanup_action, $this);
     }
     $this->suite_cleanup_actions = [];
     parent::_afterSuite();
 }
Example #26
0
 /**
  * Provide and override for the config settings and allow custom settings depending on the service being used.
  */
 protected function validateConfig()
 {
     // Customisable requirement fields depending on the queue type selected. (aws_sqs, iron_mq, beanstalkq)
     switch (strtolower($this->config['type'])) {
         case 'aws':
         case 'sqs':
         case 'aws_sqs':
             $this->requiredFields = array('key', 'secret', 'region');
             break;
         case 'iron':
         case 'iron_mq':
             $this->requiredFields = array('host', 'token', 'project');
             break;
         default:
             $this->requiredFields = array('host');
             $this->config = array_merge(array('port' => 11300, 'timeout' => 90), $this->config);
     }
     parent::validateConfig();
 }
Example #27
0
 /**
  * @param TestCase $testcase
  */
 public function _after(TestCase $testcase)
 {
     Test::clean();
     parent::_after($testcase);
 }
 public function __construct(ModuleContainer $moduleContainer, $config = null)
 {
     //$this->I = $moduleContainer->getModule("WebDriver");
     parent::__construct($moduleContainer, $config);
     $this->I = $this->moduleContainer->getModule("WebDriver");
 }
Example #29
0
 /**
  * @param TestCase $testcase
  */
 public function _after(TestCase $testcase)
 {
     $this->unloadFixtures();
     parent::_after($testcase);
 }
Example #30
0
 public function _after(\Codeception\TestCase $test)
 {
     parent::_after($test);
 }