![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/codeception/codeception/src/Codeception/Lib/Generator/ |
<?php declare(strict_types=1); namespace Codeception\Lib\Generator; use Codeception\Exception\ConfigurationException; use Codeception\Lib\Generator\Shared\Classname; use Codeception\Util\Shared\Namespaces; use Codeception\Util\Template; class Cest { use Classname; use Namespaces; protected string $template = <<<EOF <?php {{namespace}} class {{name}}Cest { public function _before({{actor}} \$I) { } // tests public function tryToTest({{actor}} \$I) { } } EOF; protected ?string $name; public function __construct(string $className, protected array $settings) { $this->name = $this->removeSuffix($className, 'Cest'); } public function produce(): string { $actor = $this->settings['actor']; if (!$actor) { throw new ConfigurationException("Cest can't be created for suite without an actor. Add `actor: SomeTester` to suite config"); } $namespaceHeader = $this->getNamespaceHeader($this->settings['namespace'] . '\\' . ucfirst($this->settings['suite']) . '\\' . $this->name); if ($namespaceHeader) { $namespaceHeader .= "\nuse " . $this->supportNamespace() . $actor . ";"; } return (new Template($this->template)) ->place('name', $this->getShortClassName($this->name)) ->place('namespace', $namespaceHeader) ->place('actor', $actor) ->produce(); } }