當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。