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


PHP Configuration::modules方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $suites = $this->getSuites($input->getOption('config'));
     $output->writeln("<info>Building Guy classes for suites: " . implode(', ', $suites) . '</info>');
     foreach ($suites as $suite) {
         $settings = $this->getSuiteConfig($suite, $input->getOption('config'));
         $namespace = rtrim($settings['namespace'], '\\');
         $modules = \Codeception\Configuration::modules($settings);
         $code = array();
         $methodCounter = 0;
         $output->writeln('<info>' . $settings['class_name'] . "</info> includes modules: " . implode(', ', array_keys($modules)));
         $docblock = array();
         foreach ($modules as $module) {
             $docblock[] = "use " . get_class($module) . ";";
         }
         $methods = array();
         $actions = \Codeception\Configuration::actions($modules);
         foreach ($actions as $action => $moduleName) {
             if (in_array($action, $methods)) {
                 continue;
             }
             $module = $modules[$moduleName];
             $method = new \ReflectionMethod(get_class($module), $action);
             $code[] = $this->addMethod($method);
             $methods[] = $action;
             $methodCounter++;
         }
         $docblock = $this->prependAbstractGuyDocBlocks($docblock);
         $contents = sprintf($this->template, $namespace ? "namespace {$namespace};" : '', implode("\n", $docblock), 'class', $settings['class_name'], '\\Codeception\\AbstractGuy', implode("\n\n ", $code));
         $file = $settings['path'] . $this->getClassName($settings['class_name']) . '.php';
         $this->save($file, $contents, true);
         $output->writeln("{$settings['class_name']}.php generated successfully. {$methodCounter} methods added");
     }
 }
开发者ID:gargallo,项目名称:tfs-test,代码行数:34,代码来源:Build.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = \Codeception\Configuration::config();
     $suites = \Codeception\Configuration::suites();
     foreach ($suites as $suite) {
         $settings = \Codeception\Configuration::suiteSettings($suite, $config);
         $modules = \Codeception\Configuration::modules($settings);
         $phpdoc = array();
         $methodCounter = 0;
         foreach ($modules as $modulename => $module) {
             $class = new \ReflectionClass('\\Codeception\\Module\\' . $modulename);
             $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
             $phpdoc[] = '';
             $phpdoc[] = 'Methods from ' . $modulename;
             foreach ($methods as $method) {
                 if (strpos($method->name, '_') === 0) {
                     continue;
                 }
                 $params = array();
                 foreach ($method->getParameters() as $param) {
                     if ($param->isOptional()) {
                         continue;
                     }
                     $params[] = '$' . $param->name;
                 }
                 $params = implode(', ', $params);
                 $phpdoc[] = '@method ' . $settings['class_name'] . ' ' . $method->name . '(' . $params . ')';
                 $methodCounter++;
             }
         }
         $contents = sprintf($this->template, implode("\r\n * ", $phpdoc), 'class', $settings['class_name'], '\\Codeception\\AbstractGuy');
         file_put_contents($file = $settings['path'] . $settings['class_name'] . '.php', $contents);
         $output->writeln("{$file} generated sucessfully. {$methodCounter} methods added");
     }
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:35,代码来源:Build.php

示例3: testModules

 public function testModules()
 {
     $settings = array('modules' => array('enabled' => array('EmulateModuleHelper')), 'class_name' => 'CodeGuy', 'path' => $this->config['paths']['tests'] . '/unit');
     $modules = \Codeception\Configuration::modules($settings);
     $this->assertArrayHasKey('EmulateModuleHelper', $modules);
     $this->assertTrue(method_exists($modules['EmulateModuleHelper'], 'seeEquals'));
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:7,代码来源:ConfigurationTest.php

示例4: initializeModules

 protected function initializeModules()
 {
     self::$modules = Configuration::modules($this->settings);
     self::$actions = Configuration::actions(self::$modules);
     foreach (self::$modules as $module) {
         $module->_initialize();
     }
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:8,代码来源:SuiteManager.php

示例5: testModules

 /**
  * @group core
  */
 public function testModules()
 {
     $settings = array('modules' => array('enabled' => array('EmulateModuleHelper')));
     $modules = \Codeception\Configuration::modules($settings);
     $this->assertContains('EmulateModuleHelper', $modules);
     $settings = array('modules' => array('enabled' => array('EmulateModuleHelper'), 'disabled' => array('EmulateModuleHelper')));
     $modules = \Codeception\Configuration::modules($settings);
     $this->assertNotContains('EmulateModuleHelper', $modules);
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:12,代码来源:ConfigurationTest.php

示例6: __construct

 public function __construct(EventDispatcher $dispatcher, $name, $settings)
 {
     $this->settings = array_merge($this->defaults, $settings);
     $this->dispatcher = $dispatcher;
     $this->suite = $this->createSuite($name);
     $this->path = $settings['path'];
     $this->settings['bootstrap'] = $this->path . $settings['bootstrap'];
     self::$modules = \Codeception\Configuration::modules($settings);
     self::$actions = \Codeception\Configuration::actions(self::$modules);
 }
开发者ID:nike-17,项目名称:Codeception,代码行数:10,代码来源:SuiteManager.php

示例7: __construct

 public function __construct($settings)
 {
     $this->name = $settings['class_name'];
     $this->settings = $settings;
     $this->di = new Di();
     $modules = Configuration::modules($this->settings);
     $this->moduleContainer = new ModuleContainer($this->di, $settings);
     foreach ($modules as $moduleName) {
         $this->modules[$moduleName] = $this->moduleContainer->create($moduleName);
     }
     $this->actions = $this->moduleContainer->getActions();
 }
开发者ID:namnv609,项目名称:Codeception,代码行数:12,代码来源:Actions.php

示例8: __construct

 public function __construct(EventDispatcher $dispatcher, $name, array $settings)
 {
     $this->settings = $settings;
     $this->dispatcher = $dispatcher;
     $this->di = new Di();
     $this->path = $settings['path'];
     $this->groupManager = new GroupManager($settings['groups']);
     $this->moduleContainer = new ModuleContainer($this->di, $settings);
     $modules = Configuration::modules($this->settings);
     foreach ($modules as $moduleName) {
         $this->moduleContainer->create($moduleName);
     }
     $this->moduleContainer->validateConflicts();
     if (isset($settings['current_environment'])) {
         $this->env = $settings['current_environment'];
     }
     $this->suite = $this->createSuite($name);
 }
开发者ID:k-serenade,项目名称:Codeception,代码行数:18,代码来源:SuiteManager.php

示例9: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->addStyles($output);
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     $config = Configuration::config($input->getOption('config'));
     if (!Configuration::isEmpty() && !$test && strpos($suite, $config['paths']['tests']) === 0) {
         list(, $suite, $test) = $this->matchTestFromFilename($suite, $config['paths']['tests']);
     }
     $settings = $this->getSuiteConfig($suite, $input->getOption('config'));
     $dispatcher = new EventDispatcher();
     $dispatcher->addSubscriber(new ConsolePrinter(['colors' => !$input->getOption('no-ansi'), 'steps' => true, 'verbosity' => OutputInterface::VERBOSITY_VERBOSE]));
     $dispatcher->addSubscriber(new BootstrapLoader());
     $suiteManager = new SuiteManager($dispatcher, $suite, $settings);
     $moduleContainer = $suiteManager->getModuleContainer();
     foreach (Configuration::modules($settings) as $module) {
         $moduleContainer->mock($module, new Maybe());
     }
     $suiteManager->loadTests($test);
     $tests = $suiteManager->getSuite()->tests();
     $dispatcher->dispatch(Events::SUITE_INIT, new SuiteEvent($suiteManager->getSuite(), null, $settings));
     $dispatcher->dispatch(Events::SUITE_BEFORE, new SuiteEvent($suiteManager->getSuite(), null, $settings));
     foreach ($tests as $test) {
         if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) {
             foreach ($test as $t) {
                 if ($t instanceof Test) {
                     $this->dryRunTest($output, $dispatcher, $t);
                 }
             }
         }
         if ($test instanceof Test and $test instanceof ScenarioDriven) {
             $this->dryRunTest($output, $dispatcher, $test);
         }
     }
     $dispatcher->dispatch(Events::SUITE_AFTER, new SuiteEvent($suiteManager->getSuite()));
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:36,代码来源:DryRun.php

示例10: __construct

 public function __construct($settings)
 {
     $this->settings = $settings;
     $this->modules = \Codeception\Configuration::modules($settings);
     $this->actions = \Codeception\Configuration::actions($this->modules);
 }
开发者ID:hilmysyarif,项目名称:erp,代码行数:6,代码来源:Actor.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = \Codeception\Configuration::config($input->getOption('config'));
     $suites = \Codeception\Configuration::suites();
     foreach ($suites as $suite) {
         $settings = \Codeception\Configuration::suiteSettings($suite, $config);
         $modules = \Codeception\Configuration::modules($settings);
         $code = array();
         $methodCounter = 0;
         $aliases = array();
         $methods[] = array();
         foreach ($modules as $modulename => $module) {
             $className = '\\Codeception\\Module\\' . $modulename;
             $class = new \ReflectionClass($className);
             $aliases[] = 'use ' . ltrim($className, '\\') . ';';
             $refMethods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
             foreach ($refMethods as $refMethod) {
                 if (strpos($refMethod->name, '_') === 0) {
                     continue;
                 }
                 if (in_array($refMethod->name, $methods)) {
                     continue;
                 }
                 $params = array();
                 foreach ($refMethod->getParameters() as $param) {
                     if ($param->isOptional()) {
                         $params[] = '$' . $param->name . ' = null';
                     } else {
                         $params[] = '$' . $param->name;
                     }
                 }
                 if (0 === strpos($refMethod->name, 'see')) {
                     $type = 'assertion';
                 } elseif (0 === strpos($refMethod->name, 'am')) {
                     $type = 'condition';
                 } else {
                     $type = 'action';
                 }
                 $doc = $refMethod->getDocComment();
                 if (!$doc) {
                     $interfaces = $class->getInterfaces();
                     foreach ($interfaces as $interface) {
                         $i = new \ReflectionClass($interface->name);
                         if ($i->hasMethod($refMethod->name)) {
                             $doc = $i->getMethod($refMethod->name)->getDocComment();
                             break;
                         }
                     }
                 }
                 if (!$doc) {
                     $parent = new \ReflectionClass($class->getParentClass()->name);
                     if ($parent->hasMethod($refMethod->name)) {
                         $doc = $parent->getMethod($refMethod->name)->getDocComment();
                     }
                 }
                 $doc = str_replace('/**', '', $doc);
                 $doc = trim(str_replace('*/', '', $doc));
                 if (!$doc) {
                     $doc = "*";
                 }
                 $params = implode(', ', $params);
                 $code[] = sprintf($this->methodTemplate, $doc, $modulename, $refMethod->name, $refMethod->name, $params, $type, $refMethod->name);
                 $methodCounter++;
                 $methods[] = $refMethod->name;
             }
         }
         // append PHPDoc for abstractGuy methods
         $className = '\\Codeception\\AbstractGuy';
         $class = new \ReflectionClass($className);
         $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
         $inherited = array();
         foreach ($methods as $method) {
             if (strpos($method->name, '_') === 0) {
                 continue;
             }
             if (in_array($method->name, $methods)) {
                 continue;
             }
             $params = array();
             foreach ($method->getParameters() as $param) {
                 if ($param->isOptional()) {
                     $params[] = '$' . $param->name . ' = null';
                 } else {
                     $params[] = '$' . $param->name;
                 }
             }
             $params = implode(', ', $params);
             $inherited[] = sprintf($this->inheritedMethodTemplate, $method->name, $params);
         }
         $aliases[] = "\n/**\n * Inherited methods";
         $aliases[] = implode("\n", $inherited);
         $aliases[] = '*/';
         $contents = sprintf($this->template, implode("\n", $aliases), 'class', $settings['class_name'], '\\Codeception\\AbstractGuy', implode("\n\n ", $code));
         file_put_contents($file = $settings['path'] . $settings['class_name'] . '.php', $contents);
         $output->writeln("{$file} generated successfully. {$methodCounter} methods added");
     }
 }
开发者ID:pfz,项目名称:codeception,代码行数:97,代码来源:Build.php


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