当前位置: 首页>>代码示例>>PHP>>正文


PHP Configuration::projectDir方法代码示例

本文整理汇总了PHP中Codeception\Configuration::projectDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Configuration::projectDir方法的具体用法?PHP Configuration::projectDir怎么用?PHP Configuration::projectDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Codeception\Configuration的用法示例。


在下文中一共展示了Configuration::projectDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suite = $input->getArgument('suite');
     $guy = $input->getArgument('guy');
     $config = \Codeception\Configuration::config($input->getOption('config'));
     $dir = \Codeception\Configuration::projectDir() . $config['paths']['tests'] . DIRECTORY_SEPARATOR;
     if (file_exists($dir . DIRECTORY_SEPARATOR . $suite)) {
         throw new \Exception("Directory {$suite} already exists.");
     }
     if (file_exists($dir . $suite . '.suite.yml')) {
         throw new \Exception("Suite configuration file '{$suite}.suite.yml' already exists.");
     }
     @mkdir($dir . DIRECTORY_SEPARATOR . $suite);
     // generate bootstrap
     file_put_contents($dir . DIRECTORY_SEPARATOR . $suite . '/_bootstrap.php', "<?php\n// Here you can initialize variables that will for your tests\n");
     if (strpos(strrev($guy), 'yuG') !== 0) {
         $guy = $guy . 'Guy';
     }
     $guyname = substr($guy, 0, -3);
     // generate helper
     file_put_contents(\Codeception\Configuration::projectDir() . $config['paths']['helpers'] . DIRECTORY_SEPARATOR . $guyname . 'Helper.php', "<?php\nnamespace Codeception\\Module;\n\n// here you can define custom functions for {$guy} \n\nclass {$guyname}Helper extends \\Codeception\\Module\n{\n}\n");
     $conf = array('class_name' => $guy, 'modules' => array('enabled' => array($guyname . 'Helper')));
     file_put_contents($dir . $suite . '.suite.yml', Yaml::dump($conf, 2));
     $output->writeln("<info>Suite {$suite} generated</info>");
 }
开发者ID:pfz,项目名称:codeception,代码行数:25,代码来源:GenerateSuite.php

示例2: _before

 public function _before(\Codeception\TestCase $test)
 {
     require_once \Codeception\Configuration::projectDir() . 'src/includes/autoload.php';
     require_once \Codeception\Configuration::projectDir() . 'src/includes/classmap.php';
     require_once \Codeception\Configuration::projectDir() . 'src/Vendor/autoload.php';
     spl_autoload_register('autoloadlitpi');
     include_once \Codeception\Configuration::projectDir() . 'src/libs/smarty/Smarty.class.php';
     //Overwrite remoteaddr
     $_SERVER['REMOTE_ADDR'] = $this->config['remoteaddr'];
     //INIT REGISTRY VARIABLE - MAIN STORAGE OF APPLICATION
     $registry = \Litpi\Registry::getInstance();
     $request = \Litpi\Request::createFromGlobals();
     $response = new \Litpi\Response();
     $session = new \Litpi\Session();
     $registry->set('request', $request);
     $registry->set('response', $response);
     $registry->set('session', $session);
     require_once \Codeception\Configuration::projectDir() . 'src/includes/conf.php';
     require_once \Codeception\Configuration::projectDir() . 'src/includes/config.php';
     require_once \Codeception\Configuration::projectDir() . 'src/includes/setting.php';
     $registry->set('conf', $conf);
     $registry->set('setting', $setting);
     $registry->set('https', PROTOCOL == 'https' ? true : false);
     require_once \Codeception\Configuration::projectDir() . 'src/includes/permission.php';
     $registry->set('groupPermisson', $groupPermisson);
     require_once \Codeception\Configuration::projectDir() . 'src/includes/rewriterule.php';
     require_once \Codeception\Configuration::projectDir() . 'src/includes/startup.php';
     $this->registry = $registry;
     $this->client = new \Codeception\Lib\Connector\LitpiConnectorHelper();
     $this->client->setRegistry($this->registry);
 }
开发者ID:tuyenv,项目名称:litpi-framework-3,代码行数:31,代码来源:LitpiHelper.php

示例3: pathToGlobalPageObject

 protected function pathToGlobalPageObject($config, $class)
 {
     $path = $this->buildPath(Configuration::projectDir() . $config['paths']['tests'] . '/_pages/', $class);
     $filename = $this->completeSuffix($class, 'Page');
     $this->introduceAutoloader(Configuration::projectDir() . $config['paths']['tests'] . DIRECTORY_SEPARATOR . $config['settings']['bootstrap'], 'Page', '_pages');
     return $path . $filename;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:GeneratePageObject.php

示例4: loadConfiguredGroupSettings

 protected function loadConfiguredGroupSettings()
 {
     foreach ($this->configuredGroups as $group => $tests) {
         $this->testsInGroups[$group] = [];
         if (is_array($tests)) {
             foreach ($tests as $test) {
                 $file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $test);
                 $this->testsInGroups[$group][] = Configuration::projectDir() . $file;
             }
         } elseif (is_file(Configuration::projectDir() . $tests)) {
             $handle = @fopen(Configuration::projectDir() . $tests, "r");
             if ($handle) {
                 while (($test = fgets($handle, 4096)) !== false) {
                     // if the current line is blank then we need to move to the next line
                     // otherwise the current codeception directory becomes part of the group
                     // which causes every single test to run
                     if (trim($test) === '') {
                         continue;
                     }
                     $file = trim(Configuration::projectDir() . $test);
                     $file = str_replace(['/', '\\'], [DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR], $file);
                     $this->testsInGroups[$group][] = $file;
                 }
                 fclose($handle);
             }
         }
     }
 }
开发者ID:foxman209,项目名称:Codeception,代码行数:28,代码来源:GroupManager.php

示例5: _initialize

 /**
  * @inheritdoc
  */
 public function _initialize()
 {
     // compute datbase info
     $match = preg_match("/host=(.*);dbname=(.*)/", env("DB_DSN"), $matches);
     if (!$match) {
         return;
     }
     $host = $matches[1];
     $name = $matches[2] . "_test";
     $user = env("DB_USER");
     $pass = env("DB_PASS");
     // compute dump file
     $dumpFile = $this->config['dump'] ?: "tests/_data/dump.sql";
     $dumpFile = Configuration::projectDir() . $dumpFile;
     if (!file_exists($dumpFile)) {
         throw new ModuleException(__CLASS__, "Dump file does not exist [ {$dumpFile} ]");
     }
     // dump
     $cmd = "mysql -h {$host} -u {$user} -p{$pass} {$name} < {$dumpFile}";
     $start = microtime(true);
     $output = shell_exec($cmd);
     $end = microtime(true);
     $diff = round(($end - $start) * 1000, 2);
     // output debug info
     $className = get_called_class();
     codecept_debug("{$className} - Importing db [ {$name} ] [ {$diff} ms ]");
     // check for error
     if ($output) {
         throw new ModuleException(__CLASS__, "Failed to import db [ {$cmd} ]");
     }
 }
开发者ID:amnah,项目名称:yii2-angular,代码行数:34,代码来源:FastDb.php

示例6: _initialize

 public function _initialize()
 {
     if ($this->config['dump'] && ($this->config['cleanup'] or $this->config['populate'])) {
         if (!file_exists(Configuration::projectDir() . $this->config['dump'])) {
             throw new \Codeception\Exception\ModuleConfig(__CLASS__, "\n                    File with dump doesn't exist.\n\n                    Please, check path for dump file: " . $this->config['dump']);
         }
         $this->dumpFile = Configuration::projectDir() . $this->config['dump'];
         $this->isDumpFileEmpty = false;
         $content = file_get_contents($this->dumpFile);
         $content = trim(preg_replace('%/\\*(?:(?!\\*/).)*\\*/%s', "", $content));
         if (!sizeof(explode("\n", $content))) {
             $this->isDumpFileEmpty = true;
         }
     }
     try {
         $this->driver = MongoDbDriver::create($this->config['dsn'], $this->config['user'], $this->config['password']);
     } catch (\MongoConnectionException $e) {
         throw new \Codeception\Exception\Module(__CLASS__, $e->getMessage() . ' while creating Mongo connection');
     }
     // starting with loading dump
     if ($this->config['populate']) {
         $this->cleanup();
         $this->loadDump();
         $this->populated = true;
     }
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:26,代码来源:MongoDb.php

示例7: __construct

 /**
  * Constructor.
  *
  * @param ModuleContainer $container
  * @param $config
  */
 public function __construct(ModuleContainer $container, $config = null)
 {
     $this->config = array_merge(['bootstrap' => 'bootstrap.php', 'application_dir' => 'application', 'modules_dir' => 'modules', 'system_dir' => 'system', 'custom_config_reader' => null], (array) $config);
     $projectDir = \Codeception\Configuration::projectDir();
     if (!defined('EXT')) {
         define('EXT', '.php');
     }
     if (!defined('DOCROOT')) {
         define('DOCROOT', realpath($projectDir) . DIRECTORY_SEPARATOR);
     }
     if (!defined('APPPATH')) {
         define('APPPATH', realpath(DOCROOT . $this->config['application_dir']) . DIRECTORY_SEPARATOR);
     }
     if (!defined('MODPATH')) {
         define('MODPATH', realpath(DOCROOT . $this->config['modules_dir']) . DIRECTORY_SEPARATOR);
     }
     if (!defined('SYSPATH')) {
         define('SYSPATH', realpath(DOCROOT . $this->config['system_dir']) . DIRECTORY_SEPARATOR);
     }
     if (!defined('KOHANA_START_TIME')) {
         define('KOHANA_START_TIME', microtime(TRUE));
     }
     if (!defined('KOHANA_START_MEMORY')) {
         define('KOHANA_START_MEMORY', memory_get_usage());
     }
     if (!defined('API_MODE')) {
         define('API_MODE', true);
     }
     $this->config['bootstrap_file'] = APPPATH . $this->config['bootstrap'];
     parent::__construct($container);
 }
开发者ID:hotrush,项目名称:kohana3-codeception,代码行数:37,代码来源:Kohana3.php

示例8: getBundleTransferSchemas

 /**
  * @return \Symfony\Component\Finder\Finder|\Symfony\Component\Finder\SplFileInfo[]
  */
 private function getBundleTransferSchemas()
 {
     $testBundleSchemaDirectory = Configuration::projectDir() . DIRECTORY_SEPARATOR . 'src';
     $finder = new Finder();
     $finder->files()->in($testBundleSchemaDirectory)->name('*.transfer.xml');
     return $finder;
 }
开发者ID:spryker,项目名称:Transfer,代码行数:10,代码来源:TransferGenerate.php

示例9: _initialize

 public function _initialize()
 {
     $cwd = getcwd();
     chdir(Configuration::projectDir());
     $this->container = (require Configuration::projectDir() . $this->config['container']);
     chdir($cwd);
     $this->application = $this->container->get('Zend\\Expressive\\Application');
     $this->initResponseCollector();
 }
开发者ID:Marfuz,项目名称:c4t_test,代码行数:9,代码来源:ZendExpressive.php

示例10: _before

 public function _before(\Codeception\TestCase $test)
 {
     $this->client = new \Codeception\Lib\Connector\Yii2();
     $this->client->configFile = \Codeception\Configuration::projectDir() . $this->config['configFile'];
     $this->app = $this->client->startApp();
     if ($this->config['cleanup'] and isset($this->app->db)) {
         $this->transaction = $this->app->db->beginTransaction();
     }
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:9,代码来源:Yii2.php

示例11: _initialize

 public function _initialize()
 {
     require Configuration::projectDir() . 'init_autoloader.php';
     $this->applicationConfig = (require Configuration::projectDir() . $this->config['config']);
     if (isset($applicationConfig['module_listener_options']['config_cache_enabled'])) {
         $applicationConfig['module_listener_options']['config_cache_enabled'] = false;
     }
     Console::overrideIsConsole(false);
 }
开发者ID:jpmanne,项目名称:twm-funcTests,代码行数:9,代码来源:ZF2.php

示例12: __construct

 /**
  * Constructor.
  *
  * @param ModuleContainer $container
  * @param null $config
  */
 public function __construct(ModuleContainer $container, $config = null)
 {
     $this->config = array_merge(['cleanup' => true, 'unit' => true, 'environment' => 'testing', 'start' => 'bootstrap' . DIRECTORY_SEPARATOR . 'start.php', 'root' => '', 'filters' => false], (array) $config);
     $projectDir = explode('workbench', Configuration::projectDir())[0];
     $projectDir .= $this->config['root'];
     $this->config['project_dir'] = $projectDir;
     $this->config['start_file'] = $projectDir . $this->config['start'];
     parent::__construct($container, null);
 }
开发者ID:Marfuz,项目名称:c4t_test,代码行数:15,代码来源:Laravel4.php

示例13: __construct

 /**
  * Constructor.
  *
  * @param ModuleContainer $container
  * @param array|null $config
  */
 public function __construct(ModuleContainer $container, $config = null)
 {
     $this->config = array_merge(['cleanup' => true, 'environment_file' => '.env', 'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php', 'root' => '', 'packages' => 'workbench', 'disable_middleware' => false, 'disable_events' => false], (array) $config);
     $projectDir = explode($this->config['packages'], \Codeception\Configuration::projectDir())[0];
     $projectDir .= $this->config['root'];
     $this->config['project_dir'] = $projectDir;
     $this->config['bootstrap_file'] = $projectDir . $this->config['bootstrap'];
     parent::__construct($container);
 }
开发者ID:IvanZuev,项目名称:Codeception,代码行数:15,代码来源:Laravel5.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param $config
  */
 public function __construct($config = null)
 {
     $this->config = array_merge(array('cleanup' => true, 'environment_file' => '.env', 'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php', 'root' => '', 'packages' => 'workbench'), (array) $config);
     $projectDir = explode($this->config['packages'], \Codeception\Configuration::projectDir())[0];
     $projectDir .= $this->config['root'];
     $this->config['project_dir'] = $projectDir;
     $this->config['bootstrap_file'] = $projectDir . $this->config['bootstrap'];
     parent::__construct();
 }
开发者ID:kansey,项目名称:yii2albom,代码行数:14,代码来源:Laravel5.php

示例15: _before

 public function _before(TestCase $test)
 {
     $index = \Codeception\Configuration::projectDir() . $this->config['index'];
     $this->client = new UniversalRunkitConnector();
     $this->client->setIndex($index);
     $this->client->setEnvModifier(function ($sandbox) use($index) {
         $sandbox->eval('function is_cli() { return false; }');
         $sandbox->chdir(dirname($index));
     });
 }
开发者ID:luka-zitnik,项目名称:CodeIgniterModule,代码行数:10,代码来源:CodeIgniter.php


注:本文中的Codeception\Configuration::projectDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。