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


PHP Configuration::testsDir方法代码示例

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


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

示例1: execute

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $suite = lcfirst($input->getArgument('suite'));
        $actor = $input->getArgument('actor');
        if ($this->containsInvalidCharacters($suite)) {
            $output->writeln("<error>Suite name '{$suite}' contains invalid characters. ([A-Za-z0-9_]).</error>");
            return;
        }
        $config = \Codeception\Configuration::config($input->getOption('config'));
        if (!$actor) {
            $actor = ucfirst($suite) . $config['actor'];
        }
        $config['class_name'] = $actor;
        $dir = \Codeception\Configuration::testsDir();
        if (file_exists($dir . $suite . '.suite.yml')) {
            throw new \Exception("Suite configuration file '{$suite}.suite.yml' already exists.");
        }
        $this->buildPath($dir . $suite . DIRECTORY_SEPARATOR, $config['settings']['bootstrap']);
        // generate bootstrap
        $this->save($dir . $suite . DIRECTORY_SEPARATOR . $config['settings']['bootstrap'], "<?php\n// Here you can initialize variables that will be available to your tests\n", true);
        $actorName = $this->removeSuffix($actor, $config['actor']);
        $file = $this->buildPath(\Codeception\Configuration::supportDir() . "Helper", "{$actorName}.php") . "{$actorName}.php";
        $gen = new Helper($actorName, $config['namespace']);
        // generate helper
        $this->save($file, $gen->produce());
        $conf = <<<EOF
class_name: {{actor}}
modules:
    enabled:
        - {{helper}}
EOF;
        $this->save($dir . $suite . '.suite.yml', (new Template($conf))->place('actor', $actorName . $config['actor'])->place('helper', $gen->getHelperName())->produce());
        $output->writeln("<info>Suite {$suite} generated</info>");
    }
开发者ID:vladislavl-hyuna,项目名称:crmapp,代码行数:34,代码来源:GenerateSuite.php

示例2: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suite = ucfirst($input->getArgument('suite'));
     $actor = $input->getArgument('actor');
     if ($this->containsInvalidCharacters($suite)) {
         $output->writeln("<error>Suite name '{$suite}' contains invalid characters. ([A-Za-z0-9_]).</error>");
         return;
     }
     $config = \Codeception\Configuration::config($input->getOption('config'));
     if (!$actor) {
         $actor = $suite . $config['actor'];
     }
     $config['class_name'] = $actor;
     $dir = \Codeception\Configuration::testsDir();
     if (file_exists($dir . $suite . '.suite.yml')) {
         throw new \Exception("Suite configuration file '{$suite}.suite.yml' already exists.");
     }
     $this->buildPath($dir . $suite . DIRECTORY_SEPARATOR, 'bootstrap.php');
     // generate bootstrap
     $this->save($dir . $suite . DIRECTORY_SEPARATOR . 'bootstrap.php', "<?php\n// Here you can initialize variables that will be available to your tests\n", true);
     $actorName = $this->removeSuffix($actor, $config['actor']);
     // generate helper
     $this->save(\Codeception\Configuration::helpersDir() . $actorName . 'Helper.php', (new Helper($actorName, $config['namespace']))->produce());
     $enabledModules = ['Cake\\Codeception\\Helper', 'App\\TestSuite\\Codeception\\' . $actorName . 'Helper'];
     if ('Unit' === $suite) {
         array_shift($enabledModules);
     }
     $conf = ['class_name' => $actorName . $config['actor'], 'modules' => ['enabled' => $enabledModules]];
     $this->save($dir . $suite . '.suite.yml', Yaml::dump($conf, 2));
     $output->writeln("<info>Suite {$suite} generated</info>");
 }
开发者ID:cakephp,项目名称:codeception,代码行数:31,代码来源:GenerateSuite.php

示例3: execute

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $suite = lcfirst($input->getArgument('suite'));
        $actor = $input->getArgument('actor');

        $config = \Codeception\Configuration::config($input->getOption('config'));
        if (!$actor) {
            $actor = ucfirst($suite) . $config['actor'];
        }
        $config['class_name'] = $actor;

        $dir = \Codeception\Configuration::testsDir();
        if (file_exists($dir . $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.");
        }

        $this->buildPath($dir . $suite . DIRECTORY_SEPARATOR, '_bootstrap.php');

        // generate bootstrap
        $this->save($dir . $suite . DIRECTORY_SEPARATOR . '_bootstrap.php',
            "<?php\n// Here you can initialize variables that will for your tests\n",
            true
        );
        $actorName = $this->removeSuffix($actor, $config['actor']);

        // generate helper
        $this->save(
            \Codeception\Configuration::helpersDir() . $actorName . 'Helper.php',
            (new Helper($actorName, $config['namespace']))->produce()
        );

        $conf = array(
            'class_name' => $actorName.$config['actor'],
            'modules' => array(
                'enabled' => array($actorName . 'Helper')
            ),
        );

        $this->save($dir . $suite . '.suite.yml', Yaml::dump($conf, 2));

        $output->writeln("<info>Suite $suite generated</info>");
    }
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:45,代码来源:GenerateSuite.php

示例4: getTestsDir

 public function getTestsDir()
 {
     return Config::testsDir();
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:4,代码来源:Extension.php


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