diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 000000000..cb5ec02d0 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_JOBS: "16" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..fc8539063 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +# This is a basic workflow to help you get started with Actions + +name: Auto-publish website + +# Controls when the workflow will run +on: + schedule: + - cron: "0 * * * *" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PAT }} + + - name: authorize + run: | + git config --local user.email "${GITHUB_ACTOR}@bots.github.com" + git config --local user.name "github-actions[bot]" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + php-version: 8.2 + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Build docs + run: ./vendor/bin/robo build:docs + + - name: Build changelog + run: ./vendor/bin/robo changelog + env: + GH_PAT: ${{ secrets.GH_PAT }} + + - name: Publish docs + run: ./vendor/bin/robo publish + diff --git a/.gitignore b/.gitignore index 75100cf41..e954f2dc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,13 @@ _site/ +/.idea .jekyll-metadata +/build +/composer.lock +Gemfile.lock +/docs/modules/AbstractAsserts.md +/docs/modules/Phalcon.md +/docs/modules/Phalcon4.md +/package/composer.lock +/package/vendor +/vendor +.jekyll-cache diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..753bece1d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: ruby +cache: bundler + +script: + - bundle exec jekyll algolia push +rvm: + - 2.2 \ No newline at end of file diff --git a/404.html b/404.html new file mode 100644 index 000000000..bedf43174 --- /dev/null +++ b/404.html @@ -0,0 +1,14 @@ +--- +layout: bootstrap +title: Page Not Found +permalink: /404.html +--- + +
+

Page not found.

+

Sorry – the page you're looking for doesn't exist.

+

Perhaps you typed the URL incorrectly, or it may have moved.

+

Back To Home

+
+ + diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..52816f1c6 --- /dev/null +++ b/Gemfile @@ -0,0 +1,12 @@ +source 'https://rubygems.org' + +gem 'jekyll', '~> 4.3.3' +gem 'kramdown' +gem 'rouge' +gem 'webrick' +gem 'wdm', '~> 0.1.1', :install_if => Gem.win_platform? + + +group :jekyll_plugins do + gem 'jekyll-algolia', '~> 1.7.1' +end diff --git a/README.md b/README.md index b75923111..925d83538 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Codeception Site +# Codeception.com Website -http://codeception.com +https://codeception.com If you want to improve the site, please submit your pull requests. Most of design changes are welcome! To run site locally (published with Github pages) you need to install [Jekyll](https://jekyllrb.com/) diff --git a/RoboFile.php b/RoboFile.php index 83b68695a..d8cce2d4d 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -1,102 +1,684 @@ ask("Post title"); - $file = strtolower(str_replace([' ',':'], ['-','-'], $title)); - $date = date('Y-m-d'); - $this->taskWriteToFile("_posts/$date-$file.markdown") - ->line('---') - ->line('layout: post') - ->line("title: \"$title\"") - ->line("date: $date 01:03:50") - ->line("---\n") - ->run(); - } - - function publish() - { - $this->taskGitStack() - ->add('-A') - ->commit('updated') - ->pull() - ->push() - ->run(); - } - - - /** - * builds docs for specific branch - * @param [type] $branch [description] - * @return [type] [description] - */ - function docsBranch($branch) - { - $this->yell("Creating docs for $branch"); - $dir = "docs-$branch"; - - $this->taskGitStack() - ->cloneRepo('git@github.com:Codeception/Codeception.git', 'source') - ->run(); - - $this->taskGitStack() - ->dir('source') - ->checkout($branch) - ->run(); - - $this->taskCleanDir($dir)->run(); - - $this->taskWriteToFile("_includes/doc_$branch.html") - ->text('
') - ->text('You are viewing documentation for Codeception '.$branch.'. ') - ->text('Switch to latest stable »') - ->text('
') - ->run(); - - - $indexFile = $this->taskWriteToFile($dir . '/index.md') - ->line('---') - ->line('layout: doc') - ->line("title: Codeception $branch Documentation") - ->line('---') - ->text("\n\n{% include doc_$branch.html %}\n\n\n") - ->line("# Codeception $branch Guides\n\n"); - - $guides = Finder::create() - ->ignoreVCS(true) - ->depth('== 0') - ->name('*.md') - ->sortByName() - ->in('source/docs'); - - - foreach ($guides as $file) { - $contents = file_get_contents($file->getRealPath()); - $name = substr($file->getBasename(),0,-3); - $title = preg_replace("(\d+-)", '', $name); - if (preg_match('/^# (.*)$/m', $contents, $matches)) { - $title = $matches[1]; - } - $indexFile->line("* [$title](/$dir/$name)"); - - $this->taskWriteToFile($dir . '/' . $file->getBasename()) - ->line('---') - ->line('layout: doc') - ->line('title: Codeception Documentation') - ->line('---') - ->line('') - ->line('') - ->text("{% include doc_$branch.html %}") - ->line('') - ->line('') - ->text($contents) - ->run(); - } - $indexFile->run(); - // $this->taskDeleteDir('source')->run(); - } -} \ No newline at end of file + use DocumentationHelpers; + + const REPO_BLOB_URL = 'https://github.com/Codeception/Codeception/blob'; + const BRANCH_5x = '5.3'; + const BRANCH_MAIN = 'main'; + + function post() + { + $title = $this->ask("Post title"); + $file = strtolower(str_replace([ + ' ', + ':' + ], [ + '-', + '-' + ], $title)); + $date = date('Y-m-d'); + $this->taskWriteToFile("_posts/$date-$file.markdown") + ->line('---') + ->line('layout: post') + ->line("title: \"$title\"") + ->line("date: $date 01:03:50") + ->line("---\n") + ->run(); + } + + function publish() + { + $this->taskGitStack() + ->add('-A') + ->commit('updated') + ->pull() + ->push() + ->run(); + } + + + /** + * @desc generates modules reference from source files + */ + public function buildDocs() + { + $this->say('generating documentation from source files'); + $this->taskComposerUpdate()->preferSource()->run(); + $this->buildDocsModules(); + $this->buildDocsUtils(); + $this->buildDocsCommands(); + $this->buildDocsStub(); + $this->buildDocsApi(); + $this->buildDocsExtensions(); + $this->changelog(); + } + + public function buildDocsModules() + { + $this->taskCleanDir('docs/modules')->run(); + $this->say("Modules"); + $modules = Finder::create()->files()->name('*.php')->in(__DIR__ . '/vendor/codeception/module-*/src/Codeception/Module')->depth('== 0'); + foreach ($modules as $module) { + $moduleName = basename(substr($module, 0, -4)); + $className = 'Codeception\Module\\' . $moduleName; + $classPath = 'Codeception/Module/' . $moduleName; + $repositoryName = basename(substr($module, 0, -1 * (strlen($classPath) + 9))); + //echo $classPath, " ", $repositoryName, "\n"; continue; + //TODO: take /src/$classPath.php directly from module + $source = "https://github.com/Codeception/$repositoryName/tree/master/src/$classPath.php"; + $documentationFile = 'docs/modules/' . $moduleName . '.md'; + $sourceMessage = '

 

Module reference is taken from the source code. Help us to improve documentation. Edit module reference
'; + $this->generateDocumentationForClass($className, $documentationFile, $sourceMessage); + $this->postProcessModuleDocFile($documentationFile, $moduleName, $source); + } + //Page of old module displays content of new module + $this->taskFilesystemStack()->symlink('Mezzio.md', 'docs/modules/ZendExpressive.md')->run(); + $this->taskFilesystemStack()->symlink('Laravel.md', 'docs/modules/Laravel5.md')->run(); + $this->taskFilesystemStack()->symlink('Laminas.md', 'docs/modules/ZF2.md')->run(); + + // Don't update old Phalcon modules + $this->taskGitStack() + ->stopOnFail() + ->checkout('-- docs/modules/Phalcon.md docs/modules/Phalcon4.md') + ->run(); + } + + private function postProcessModuleDocFile($documentationFile, $name, $source) + { + $contents = file_get_contents($documentationFile); + $contents = str_replace('## ', '### ', $contents); + $buttons = [ + 'source' => $source, + ]; + $buttonHtml = "\n\n" . '
'; + $releasesUrl = "https://github.com/Codeception/module-$name/releases"; + $buttonHtml .= 'Releases'; + foreach ($buttons as $link => $url) { + if ($link == 'source') { + $link = "$link"; + } + $buttonHtml .= '' . $link . ''; + } + $buttonHtml .= '
' . "\n\n"; + + $contents = $this->postProcessStandardElements($name, $buttonHtml . $contents); + file_put_contents($documentationFile, $contents); + } + + public function buildDocsUtils() + { + $this->say("Util Classes"); + $utils = [ + 'Autoload' => null, + 'Fixtures' => null, + 'Locator' => 'lib-web', + 'XmlBuilder' => 'lib-xml', + 'JsonType' => 'module-rest', + 'HttpCode' => 'lib-innerbrowser', + ]; + + foreach ($utils as $utilName => $repositoryName) { + $className = '\Codeception\Util\\' . $utilName; + try { + $documentationFile = 'docs/reference/' . $utilName . '.md'; + $this->documentApiClass($documentationFile, $className, false, $repositoryName); + $this->postProcessFile($utilName, $documentationFile); + } catch (\Exception $err) { + + } + } + } + + public function buildDocsCommands() + { + $this->say("Commands"); + + $path = __DIR__ . '/vendor/codeception/codeception/src/Codeception/Command'; + $commands = Finder::create()->files()->name('*.php')->depth(0)->in($path); + + $documentationFile = 'docs/reference/Commands.md'; + $commandGenerator = $this->taskGenDoc($documentationFile); + foreach ($commands as $command) { + $commandName = basename(substr($command, 0, -4)); + $className = '\Codeception\Command\\' . $commandName; + $commandGenerator->docClass($className); + } + $commandGenerator + ->prepend("# Console Commands\n") + ->processClassSignature(function ($r, $text) { + return "## " . $r->getShortName(); + }) + ->filterMethods(function (ReflectionMethod $r) { + return false; + }) + ->run(); + + $this->postProcessFile('Commands', $documentationFile); + } + + public function buildDocsStub() + { + $this->say("Stub Classes"); + + $stubFile = 'docs/reference/Stub.md'; + $this->taskGenDoc($stubFile) + ->docClass('Codeception\Stub') + ->filterMethods(function (\ReflectionMethod $method) { + if ($method->isConstructor() or $method->isDestructor()) { + return false; + } + if (!$method->isPublic()) { + return false; + } + if (strpos($method->name, '_') === 0) { + return false; + } + return true; + }) + ->processMethodDocBlock( + function (\ReflectionMethod $m, $doc) { + $doc = str_replace(array('@since'), array(' * available since version'), $doc); + $doc = str_replace(array( + ' @', + "\n@" + ), array( + " * ", + "\n * " + ), $doc); + return $doc; + } + ) + ->processProperty(false) + ->run(); + + $mocksDocumentation = <<taskGenDoc($mockFile) + ->docClass('Codeception\Test\Feature\Stub') + ->docClass('Codeception\Stub\Expected') + ->processClassDocBlock(false) + ->processClassSignature(false) + ->prepend($mocksDocumentation) + ->filterMethods(function (\ReflectionMethod $method) { + if ($method->isConstructor() or $method->isDestructor()) { + return false; + } + if (!$method->isPublic()) { + return false; + } + if (strpos($method->name, '_') === 0) { + return false; + } + if (strpos($method->name, 'stub') === 0) { + return false; + } + return true; + }) + ->run(); + + $this->postProcessFile('Stub', $stubFile); + $this->postProcessFile('Mock', $mockFile); + } + + public function buildDocsApi() + { + $this->say("API Classes"); + $apiClasses = ['\Codeception\Module', '\Codeception\InitTemplate']; + + foreach ($apiClasses as $apiClass) { + $name = (new ReflectionClass($apiClass))->getShortName(); + $documentationFile = 'docs/reference/' . $name . '.md'; + $this->documentApiClass($documentationFile, $apiClass, true); + $this->postProcessFile($name, $documentationFile); + } + } + + public function buildDocsExtensions() + { + $this->say('Extensions'); + + $path = __DIR__ . '/vendor/codeception/codeception/ext'; + $extensions = Finder::create()->files()->sortByName()->name('*.php')->in($path); + + $extGenerator = $this->taskGenDoc('_includes/extensions.md'); + foreach ($extensions as $extension) { + $extensionName = basename(substr($extension, 0, -4)); + $className = '\Codeception\Extension\\' . $extensionName; + $extGenerator->docClass($className); + } + $extGenerator + ->prepend("# Official Extensions\n") + ->processClassSignature(function (ReflectionClass $r, $text) { + $name = $r->getShortName(); + return "## $name\n\n[See Source](" . self::REPO_BLOB_URL . "/" . self::BRANCH_MAIN . "/ext/$name.php)"; + }) + ->filterMethods(function (ReflectionMethod $r) { + return false; + }) + ->filterProperties(function ($r) { + return false; + }) + ->run(); + } + + protected function documentApiClass($file, $className, $all = false, $repositoryName = null) + { + if ($repositoryName === null) { + $repositoryUrl = self::REPO_BLOB_URL . "/" . self::BRANCH_5x; + } else { + $repositoryUrl = 'https://github.com/Codeception/' . $repositoryName . '/blob/master'; + } + $uri = str_replace('\\', '/', $className); + $source = $repositoryUrl . "/src$uri.php"; + + $this->taskGenDoc($file) + ->docClass($className) + ->filterMethods(function (ReflectionMethod $r) use ($all, $className) { + return $all || $r->isPublic(); + }) + ->append( + '

 

Reference is taken from the source code. ' + . 'Help us to improve documentation. Edit module reference
' + ) + ->processPropertySignature(function ($r) { + return "\n#### $" . $r->name . "\n\n"; + }) + ->processPropertyDocBlock(function ($r, $text) { + $modifiers = implode(' ', \Reflection::getModifierNames($r->getModifiers())); + $text = ' *' . $modifiers . '* **$' . $r->name . "**\n" . $text; + $text = preg_replace("~@(.*?)\s(.*)~", 'type `$2`', $text); + return $text; + }) + ->processClassDocBlock( + function (ReflectionClass $r, $text) { + return $text . "\n"; + } + ) + ->processMethodSignature(function ($r, $text) { + return "#### {$r->name}()\n\n" . ltrim($text, '#'); + }) + ->processMethodDocBlock( + function (ReflectionMethod $r, $text) use ($file, $source) { + //$file = str_replace(__DIR__, '', $r->getFileName()); + //$source = self::REPO_BLOB_URL."/".self::STABLE_BRANCH. $file; + + $line = $r->getStartLine(); + $text = preg_replace("~^\s?@(.*?)\s~m", ' * `$1` $2', $text); + $text .= "\n[See source]($source#L$line)"; + return "\n" . $text . "\n"; + } + ) + ->reorderMethods('ksort') + ->run(); + } + + public function changelog() { + $this->say('building changelog'); + $this->taskWriteToFile('changelog.markdown') + ->line('---') + ->line('layout: page') + ->line('title: Codeception Changelog') + ->line('---') + ->line('') + ->line( + '
Download specific version at builds page
' + ) + ->line('') + ->line('# Changelog') + ->line('') + ->line($this->processChangelog()) + ->run(); + } + + protected function oldProcessChangelog() + { + $sortByVersionDesc = function (\SplFileInfo $a, \SplFileInfo $b) { + $pattern = '/^CHANGELOG-(\d+\.(?:x|\d+)).md$/'; + if (preg_match($pattern, $a->getBasename(), $matches1) && preg_match($pattern, $b->getBasename(), $matches2)) { + return version_compare($matches1[1], $matches2[1]) * -1; + } + return 0; + }; + $changelogFiles = Finder::create()->name('CHANGELOG-*.md')->in('vendor/codeception/codeception')->depth(0)->sort($sortByVersionDesc); + $changelog = "\n"; + foreach ($changelogFiles as $file) { + $changelog .= trim($file->getContents(), "\r\n") . "\n\n"; + } + //user + $changelog = preg_replace('~\s@([\w-]+)~', ' **[$1](https://github.com/$1)**', $changelog); + //issue + $changelog = preg_replace( + '~#(\d+)~', + '[#$1](https://github.com/Codeception/Codeception/issues/$1)', + $changelog + ); + //module + $changelog = preg_replace('~\s\[(\w+)\]\s~', ' **[$1]** ', $changelog); + return $changelog; + } + + /** + * @param $name + * @param $contents + * @return mixed|string|string[]|null + */ + private function postProcessStandardElements($name, $contents) + { + $highlight_languages = implode('|', [ + 'php', + 'html', + 'bash', + 'yaml', + 'json', + 'xml', + 'sql', + 'gherkin' + ]); + $contents = preg_replace( + "~```\s?($highlight_languages)\b(.*?)```~ms", + "{% highlight $1 %}\n$2\n{% endhighlight %}", + $contents + ); + $contents = str_replace('{% highlight %}', '{% highlight yaml %}', $contents); + $contents = preg_replace("~```\s?(.*?)```~ms", "{% highlight yaml %}\n$1\n{% endhighlight %}", $contents); + // set default language in order not to leave unparsed code inside '```' + + $title = $name; + $contents = "---\nlayout: doc\ntitle: " . ($title != "" ? $title . " - " : "") + . "Codeception - Documentation\n---\n\n" . $contents; + return $contents; + } + + /** + * @param $pageName + * @param $documentationFile + */ + private function postProcessFile($pageName, $documentationFile) + { + $contents = $this->postProcessStandardElements($pageName, file_get_contents($documentationFile)); + file_put_contents($documentationFile, $contents); + } + + public function buildPhar82() + { + $ignoredPlatformReqs = array( + 'ext-apcu', + 'ext-mongodb', + 'ext-phalcon', + ); + + $version = self::BRANCH_5x . '.' . date('Ymd'); + $releaseDir = "releases/$version"; + $this->stopOnFail(); + $this->taskFilesystemStack()->mkdir('build/82')->run(); + $this->setCodeceptionVersionTo('^' . self::BRANCH_5x, $ignoredPlatformReqs); + $this->setPlatformVersionTo('8.2.0', $ignoredPlatformReqs); + $buildFile = 'build/82/codecept.phar'; + $this->buildPhar($buildFile); + $this->updateVersionFile($buildFile, 'php82/codecept.version'); + $versionedFile = "$releaseDir/codecept.phar"; + $this->taskFilesystemStack() + ->stopOnFail() + ->mkdir($releaseDir) + ->copy($buildFile, $versionedFile) + ->remove('php82/codecept.phar') + ->symlink("../$versionedFile", 'php82/codecept.phar') + ->run(); + } + + public function release82() + { + $version = self::BRANCH_5x . '.' . date('Ymd'); + $releaseDir = "releases/$version"; + $this->updateBuildsPage(); + + $this->taskGitStack() + ->stopOnFail() + ->checkout('-- package/composer.json') + ->add('builds.markdown') + ->add('php82/codecept.phar') + ->add('php82/codecept.version') + ->add($releaseDir) + ->run(); + } + + private function setPlatformVersionTo($version, $ignoredPlatformReqs = array()) + { + $this->taskComposerConfig()->workingDir('package')->set('platform.php', $version)->run(); + $composerUpdate = $this->taskComposerUpdate(); + foreach ($ignoredPlatformReqs as $ignoredPlatformReq) { + $composerUpdate->option('--ignore-platform-req', $ignoredPlatformReq); + } + $composerUpdate->preferDist()->optimizeAutoloader()->workingDir('package')->run(); + } + + private function setCodeceptionVersionTo($version, $ignoredPlatformReqs = array()) + { + $composerRequire = $this->taskComposerRequire() + ->dependency('codeception/codeception', $version); + foreach ($ignoredPlatformReqs as $ignoredPlatformReq) { + $composerRequire->option('--ignore-platform-req', $ignoredPlatformReq); + } + $composerRequire->workingDir('package') + ->run(); + } + + /** + * @desc creates codecept.phar + * @throws Exception + */ + public function buildPhar($targetFile) + { + $this->packPhar($targetFile); + $dir = dirname($targetFile); + //the file must be named codecept.phar to be executable + $this->taskFilesystemStack()->copy($targetFile, $dir . '/codecept.phar')->run(); + $code = $this->taskExec('php codecept.phar')->dir($dir)->run()->getExitCode(); + if ($code !== 0) { + throw new Exception("There was problem compiling phar"); + } + } + + private function packPhar($pharFileName) + { + $pharTask = $this->taskPackPhar($pharFileName) + ->compress() + ->stub('package/stub.php'); + + $finder = Finder::create()->files() + ->ignoreVCS(true) + ->name('*.php') + ->name('*.php8') + ->name('*.css') + ->name('*.png') + ->name('*.js') + ->name('*.css') + ->name('*.eot') + ->name('*.svg') + ->name('*.ttf') + ->name('*.wof') + ->name('*.woff') + ->name('*.woff2') + ->name('*.png') + ->name('*.tpl') + ->name('*.tpl.dist') + ->name('*.html.dist') + ->exclude('Tests') + ->exclude('tests') + ->exclude('benchmark') + ->exclude('demo') + ->in('package/vendor'); + + foreach ($finder as $file) { + $relativePathname = $file->getRelativePathname(); + if (strpos($relativePathname, 'codeception/') === 0) { + //don't remove whitespace from Codeception files + $pharTask->addFile('vendor/' . $relativePathname, $file->getRealPath()); + } else { + $pharTask->addStripped('vendor/' . $relativePathname, $file->getRealPath()); + } + } + + $pharTask->run(); + } + + public function processChangelog() + { + $client = new \Github\Client(); + $token = getenv('GH_PAT'); + if ($token) { + $client->authenticate(getenv('GH_PAT'), null, \Github\Client::AUTH_ACCESS_TOKEN); + } + $allReleases = []; + + $repositories = $client->repos()->org('Codeception', ['per_page' => 100]); + foreach ($repositories as $repository) { + $repositoryName = $repository['name']; + if ($repositoryName !== 'Codeception' && !str_starts_with($repositoryName, 'module-') && !str_starts_with($repositoryName, 'lib-')) { + continue; + } + $this->say($repositoryName); + + if ($repository['disabled'] || $repository['archived']) { + continue; + } + try { + $releases = $client->repo()->releases()->all('codeception', $repositoryName); + foreach ($releases as $k=> $release) { + $releases[$k]['repo'] = $repositoryName; + } + $allReleases = array_merge($allReleases, $releases); + } catch (\Exception $err) { +// $this->say("Repository not available " . $repository['name']); +// $this->say($err->getMessage()); + } + } + + usort($allReleases, function($r1, $r2) { + return -(strtotime($r1['published_at']) <=> strtotime($r2['published_at'])); + }); + + $changelog = ""; + + foreach ($allReleases as $release) { + $repo = $release['repo'] ?? 'Codeception'; + $changelog .= sprintf("\n\n### %s %s: %s\n\n", $repo, $release['tag_name'], $release['name']); + + $changelog .= sprintf('Released by [![](%s){:height="16" width="16"} %s](%s) on %s', + $release['author']['avatar_url'] . '&s=16', + $release['author']['login'], + $release['author']['html_url'], + date_format(date_create($release['published_at']),"Y/m/d H:i:s") + ); + + $changelog .= " / [Repository](https://github.com/Codeception/$repo) "; + $changelog .= " / [Releases](https://github.com/Codeception/$repo/releases)\n\n"; + + $body = $release['body']; + //user + + $body = preg_replace('~\s@([\w-]+)~', ' **[$1](https://github.com/$1)**', $body); + //issue + $body = preg_replace( + '~#(\d+)~', + "[#$1](https://github.com/Codeception/$repo/issues/$1)", + $body + ); + $changelog .= "\n\n$body\n"; + } + + return $changelog; + } + + public function updateBuildsPage() + { + $sortByVersion = function (\SplFileInfo $a, \SplFileInfo $b) { + return version_compare($a->getBaseName(), $b->getBaseName()); + }; + + $releases = array_reverse( + iterator_to_array(Finder::create()->depth(0)->directories()->sort($sortByVersion)->in('releases')) + ); + $branch = null; + $releaseFile = $this->taskWriteToFile('builds.markdown') + ->line('---') + ->line('layout: page') + ->line('title: Codeception Builds') + ->line('---') + ->line(''); + + foreach ($releases as $release) { + $releaseName = $release->getBasename(); + $downloadUrl = "https://codeception.com/releases/$releaseName/codecept.phar"; + + list($major, $minor) = explode('.', $releaseName); + if ("$major.$minor" != $branch) { + $branch = "$major.$minor"; + $releaseFile->line("\n## $branch"); + if ($major < 2) { + $releaseFile->line("*Requires: PHP 5.3 and higher + CURL*\n"); + } elseif ($major == 2 && $minor < 4) { + $releaseFile->line("*Requires: PHP 5.4 and higher + CURL*\n"); + } elseif ($major < 5) { + $releaseFile->line("*Requires: PHP 5.6 and higher + CURL*\n"); + } elseif ($minor < 3) { + $releaseFile->line("*Requires: PHP 8.0 and higher + CURL*\n"); + } else { + $releaseFile->line("*Requires: PHP 8.2 and higher + CURL*\n"); + } + $releaseFile->line("* **[Download Latest $branch Release]($downloadUrl)**"); + } + + if (file_exists("releases/$releaseName/php54/codecept.phar")) { + $downloadUrl2 = "https://codeception.com/releases/$releaseName/php54/codecept.phar"; + if (version_compare($releaseName, '2.4.0', '>=')) { + $versionLine = "* [$releaseName for PHP 7]($downloadUrl)"; + $versionLine .= ", [for PHP 5.6]($downloadUrl2)"; + } elseif (version_compare($releaseName, '2.3.0', '>=')) { + $versionLine = "* [$releaseName for PHP 7]($downloadUrl)"; + $versionLine .= ", [for PHP 5.4 - 5.6]($downloadUrl2)"; + } else { + $versionLine = "* [$releaseName for PHP 5.6+]($downloadUrl)"; + $versionLine .= ", [for PHP 5.4 or 5.5]($downloadUrl2)"; + } + } elseif (file_exists("releases/$releaseName/php56/codecept.phar")) { + $versionLine = "* [$releaseName for PHP 7.2+]($downloadUrl)"; + $downloadUrl2 = "https://codeception.com/releases/$releaseName/php56/codecept.phar"; + $versionLine .= ", [for PHP 5.6 - 7.1]($downloadUrl2)"; + } else { + $versionLine = "* [$releaseName]($downloadUrl)"; + } + + $releaseFile->line($versionLine); + } + $releaseFile->run(); + } + + /** + * @param $pharFile + * @param $versionFile + */ + private function updateVersionFile($pharFile, $versionFile) + { + $hash = sha1_file($pharFile); + if ($hash === false) { + throw new Exception('Failed to write hash to file: ' . $versionFile); + } + $this->taskWriteToFile($versionFile)->text($hash)->run(); + } + + +} diff --git a/_config.yml b/_config.yml index 16665b3b2..1339b5f28 100644 --- a/_config.yml +++ b/_config.yml @@ -4,4 +4,29 @@ kramdown: input: GFM auto_ids: true syntax_highlighting: rouge -highlighter: rouge \ No newline at end of file +highlighter: rouge +exclude: [vendor] +sass: + sass_dir: _scss + style: compressed +plugins: + - jekyll-algolia +algolia: + application_id: 'G160Y1N5OT' + index_name: 'codeception' + read_only_api_key: 'c264188100c4fb7017c4f5702a7d4b8d' + allowed_extensions: + - ".markdown" + - ".html" + excluded_files: + - "index.html" + - "docs-2.0" + - "docs-1.8" + - "2012-" + - "2013-" + - "2014-" +banner: + # disable content to show last blogpost + # content: '🎉 Codeception truns 10! Join online celebration on November 30!' + # content: 'Codeception is on OpenCollective! Support us 💖' + content: '🇺🇦 Help Ukraine!' diff --git a/_data/extensions.yml b/_data/extensions.yml new file mode 100644 index 000000000..f5c77f180 --- /dev/null +++ b/_data/extensions.yml @@ -0,0 +1,85 @@ +- name: Testomat.io Reporter + link: https://github.com/testomatio/php-reporter + description: Run reports and analytics via [Testomat.io](https://testomat.io) + image: https://testomat.io/wp-content/uploads/2022/03/Real_time_report_test_result-936x573.jpg + +- name: Allure Codeception Adapter + link: https://github.com/allure-framework/allure-codeception + description: This is a Codeception adapter for [Allure Framework](http://allure.qatools.ru) + +- name: ReportPortal Agent + link: https://github.com/reportportal/agent-php-Codeception + description: Integration with [ReportPortal.io](https://reportportal.io/) AI-powered test automation dashboard + +- name: Wiremock Extension + description: Allows developers and testers to use WireMock to mock external services when running codeception tests. codeception-wiremock-extension connects to an already running instance of WireMock or can also run automatically a local standalone one. And, it is able to download the version of wiremock you preffer and run it too + link: https://github.com/mcustiel/codeception-wiremock-extension + +- name: Docker Selenium Chrome + link: https://github.com/teamneusta/codeception-docker-chrome + description: Docker Selenium Chrome for Codeception is a extension to integrate automatic selenium with chrome in your codeception tests. + +- name: PhpBuiltinServer + link: https://github.com/tiger-seo/PhpBuiltinServer + description: Extension for starting and stopping built-in PHP server. Works on Windows, Mac, Linux. + +- name: Phantoman + link: https://github.com/site5/phantoman + description: Extension for automatically starting and stopping PhantomJS when running tests. + +- name: Phiremock + link: https://github.com/mcustiel/phiremock-codeception-extension + description: Extension for automatically starting and stopping Phiremock. + +- name: Progress Reporter + link: https://github.com/fr05t1k/codeception-progress-reporter + description: The reporter with a progress bar + image: /images/extensions/codeception-progress-reporter.png + +- name: DrushDb + link: https://github.com/pfaocle/DrushDb + image: https://www.drupal.org/files/druplicon-small.png + description: DrushDb is a Codeception extension to populate and cleanup test **Drupal** sites during test runs using Drush aliases and the sql-sync command. + +- name: Notifier + link: https://github.com/Codeception/Notifier + description: Flexible notifications with notificator library. + +- name: WPBrowser, WPDatabase, WPLoader + link: https://github.com/lucatume/wp-browser + image: https://s.w.org/about/images/desktops/wp-light-lo-640x960.png + description: WordPress specific extensions of PHPBrowser and Db modules to allow for more streamlined testing of themes and plugins and a WordPress automated testing suite wrapper. + +- name: Joomla-Browser + link: https://github.com/joomla-projects/joomla-browser + description: An extended Webdriver Browser to navigate through Joomla sites with Codeception. + image: https://codeception.com/images/frameworks/joomla.png + +- name: TestStatistics + link: https://github.com/redCOMPONENT-COM/teststatistics#teststatistics + description: TestStatistics is a Codeception Extension to measure the performance of your tests. The extension lists your slower steps, probably meaning that the used locator is not performant. Is a smart tool to improve the speed of your Acceptance tests, and serves as example to create your own reporting extensions. + +- name: TeamCity + link: https://github.com/neronmoon/TeamcityCodeception + description: Integration with TeamCity CI server by service-messages + +- name: EventsScripting + link: https://github.com/oprudkyi/codeception-events-scripting + description: Run shell scripts on events - before/after suites/environments/full test run + +- name: PauseOnFail + link: https://github.com/ipeevski/PauseOnFail + description: Pause execution on failure/error - allow debugging from failed point onwardss + +- name: SecureShell + link: https://github.com/edno/codeception-secureshell + description: The Codeception module for SSH commands, SFTP access and SSH tunnels + +- name: TestRail + link: https://github.com/bookitcom/codeception-testrail + image: https://blog.gurock.com/wp-content/themes/gurock/assets/images/blog/bottom-testrail-ad.png + description: Integration with [TestRail TestCase Management](https://www.gurock.com/testrail/) + +- name: Gherkin-Dependsload + link: https://github.com/labbots/codeception-gherkin-dependsload + description: The Codeception extension for Gherkin features to load and execute dependent scenarios. This extension provides `@dependsload` annotation which lets adding dependencies to gherkin scenarios. diff --git a/_data/modules.yml b/_data/modules.yml new file mode 100644 index 000000000..d36e1192f --- /dev/null +++ b/_data/modules.yml @@ -0,0 +1,175 @@ +- name: Codeception CRAP reporter + image: https://user-images.githubusercontent.com/6382002/130051733-5a6f18eb-012c-4ef8-96f0-1a12c5b26407.png + link: https://github.com/nebbia-fitness/codecept-coverage-reporter + description: Codeception CRAP reporter is an open-source implementation tool to help you detect PHP code C.R.A.P. – which stands for Change Risk Anti-Patterns. + +- name: Amazon S3 Filesystem + link: https://github.com/polevaultweb/s3-filesystem + description: An Amazon S3 Filesystem module. + +- name: Appium Driver + link: https://github.com/tajawal/codeception-appium + description: Appium Driver to interact with appium server - iOS/Android Mobile Testing Automation. + +- name: Appium + link: https://github.com/walterwhites/Appium-codeception-module + description: Easy Appium integration, iOS Automation + +- name: Axeception + link: https://github.com/flowdgmbh/codeception-axeception + description: Run axe-core acceptance tests in codeception + +- name: BrowserMob + link: https://github.com/edno/codeception-browsermob + description: Codeception module for BrowserMob Proxy. + +- name: CakeCeption + link: https://github.com/hkzpjt/cakeception + description: Integrate Codeception to CakePHP v2.* projects. + +- name: CakePHP + image: https://pbs.twimg.com/profile_images/736902911993774080/p5C2_6xM.jpg + link: https://github.com/cakephp/codeception + description: Official CakePHP 3 module for Codeception. + +- name: Codecept UnitTest generator + image: https://user-images.githubusercontent.com/6382002/33774260-0aaacebc-dc3b-11e7-8a97-34265a4818cc.png + link: https://github.com/hyperia-sk/codecept-unittest-generator + description: Generate PHPUnit tests from annotations. + +- name: Composer Project + link: https://github.com/TypistTech/codeception-composer-project-module + description: Create throw away composer projects for Codeception tests. + +- name: Config + link: https://github.com/JustBlackBird/codeception-config-module + description: Loads params from Codeception config and pass them to test scenarios. + +- name: CSS Regression + link: https://github.com/mendicm/css-regression + description: CSS / Visual regression tests integrated in Codeception. This module can be used to compare the current representation of a website element with an expected based on a reference image. This module does not require any JavaScript injections in your website and works with viewport screenshots (chromedriver). Compatible with WebDriver and AngularJS modules. + +- name: Database Populator + link: https://github.com/vjik/codeception-db-populator + description: Module for handy populate database. Load only the tables and data that are needed for the current test. This will allow you to create and run tests faster. + color: "#86FF8A" + +- name: Date/Time + link: https://github.com/nathanmac/datetime-codeception-module + description: Additional helpers for date and time comparisons, e.g. seeDateIsToday() + +- name: Drupal + link: https://github.com/guncha25/drupal-codeception + description: Sets of codeception modules and utilities to test drupal cms. + +- name: FlySystem + link: https://github.com/lamoda/codeception-flysystem + description: Codeception FlySystem module with several adapters. Provides a set of methods for checking and modifying files on remote storage. + color: "#FFF5C4" + +- name: GherkinParam + link: https://github.com/edno/codeception-gherkin-param + description: The Codeception module for supporting parameter notation in Gherkin scenario. + +- name: HighlightCeption + image: https://user-images.githubusercontent.com/6382002/29250010-0bdb3cf6-803b-11e7-92af-f666caf497e4.png + link: https://github.com/hyperia-sk/highlight-ception + description: Highlight text or element by codeception. + color: "#FFF5C4" + +- name: HttpMock + link: https://github.com/mcustiel/codeception-http-mock + description: Module and extension to use HttpMock to mock external services when running Codeception tests. + +- name: IM + link: https://github.com/nathanmac/im-codeception-module + description: This module allows the testing against external messaging services as well as triggering notifications via your tests, currently supports HipChat messaging service. + +- name: MailCare + image: https://raw.githubusercontent.com/mailcare/codeception-module-mailcare/master/codeception-addons.png + link: https://github.com/mailcare/codeception-module-mailcare + description: Codeception module to test email using MailCare.io (Free, Open Source or paid services). + color: "#e65722" + +- name: Mailpit + image: ../images/mailpit.svg + link: https://github.com/koehnlein/codeception-email-mailpit + description: Mailpit is a standalone local SMTP server to test email deliveries. The Codeception module provides assertions such as `$I->haveUnreadEmails();` or `$I->seeInOpenedEmailHtmlBody()`. + +- name: MailCatcher + link: https://github.com/captbaritone/codeception-mailcatcher-module + description: MailCatcher is a standalone software which can be configured to catch *any* email sent by your development server, and display it on a webpage. The MailCatcher Module allows you to test the contents of those emails in an acceptance test. + +- name: MailSMTP + link: https://github.com/AhmedSamy/codeception-smtp-mail + description: This module will let you test emails using simple SMTP connection, with any provider that supports IMAP. + +- name: MailTrap + link: https://github.com/WhatDaFox/Codeception-Mailtrap + description: Codeception module to test email using Mailtrap.io. + +- name: Markup Validator + link: https://github.com/Kolyunya/codeception-markup-validator + description: A module which validates the markup (HTML, XHTML, etc.) of web documents. Works out of the box, requires no complex configuration to get started. Yet fully configurable and extendable if something special is needed. + +- name: Mockery + link: https://github.com/Codeception/MockeryModule + description: Integrates Mockery into Codeception tests. + +- name: Mountebank + link: https://github.com/meare/codeception-mountebank + description: Stub and mck external services with mountebank. + +- name: Nette + link: https://github.com/Arachne/Codeception + description: Module for Nette framework. + +- name: Percy + link: https://github.com/tr33m4n/codeception-module-percy + description: Percy https://percy.io integration + color: "#9e66bf" + +- name: Phiremock + link: https://github.com/mcustiel/phiremock-codeception-module + description: Module to mock http request to external services using Phiremock. + +- name: Private Sniffer + link: https://github.com/fkupper/private-sniffer-module/ + description: Simple module that enables sniffing into private defined elements of an object while running unit tests with Codeception. + +- name: PSR3 Logger + link: https://github.com/byteout/psr-logger-codeception-module + description: Module for validation of messages logged by PSR3 loggers. + +- name: Remote File Attachment + link: https://github.com/phmLabs/codeception-module-attachfileremote + description: This module helps to upload files when using webdriver via remote connection. + +- name: Slim + description: This module allows you to run functional tests inside Slim 4 Microframework without HTTP calls, so tests will be much faster and debug could be easier. + link: https://github.com/DoclerLabs/codeception-slim-module + +- name: Slim 3 + link: https://github.com/herloct/codeception-slim-module + description: This module allows you to run tests inside Slim 3 Microframework. Based on ZendExpressive Module. + +- name: Stepler + link: https://github.com/nicholascus/codeception-stepler + description: Enabling step-by-step console execution in bebugging mode. + +- name: VisualCeption + link: https://github.com/Codeception/VisualCeption + description: Visual regression tests integrated in Codeception. This module can be used to compare the current representation of a website element with an expected. It was written on the shoulders of codeception and integrates in a very easy way. + color: "#FFF5C4" + +- name: WordPress Browser and Database + link: https://github.com/lucatume/wp-browser + description: An extension of Codeception own PhpBrowser and Db modules to allow for easy and streamlined WordPress themes and plugins testing. + +- name: Yandex + link: https://github.com/portrino/codeception-yandex-module + description: Validation of structured data via yandex API. + +- name: Grpc + link: https://github.com/MercerMorning/codeception-grpc-module + description: Validation of grpc server. diff --git a/_includes/algolia.html b/_includes/algolia.html new file mode 100644 index 000000000..415a7dad3 --- /dev/null +++ b/_includes/algolia.html @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/_includes/cloudways.html b/_includes/cloudways.html new file mode 100644 index 000000000..b283aee3a --- /dev/null +++ b/_includes/cloudways.html @@ -0,0 +1,4 @@ + + cloudways + diff --git a/_includes/comment.html b/_includes/comment.html index 18adad61e..0b52c8748 100644 --- a/_includes/comment.html +++ b/_includes/comment.html @@ -1,8 +1,7 @@
- - \ No newline at end of file + diff --git a/_includes/companies.html b/_includes/companies.html new file mode 100644 index 000000000..2b796003c --- /dev/null +++ b/_includes/companies.html @@ -0,0 +1,31 @@ +
+ Rebilly +
+ +
+ Deposit Photos +
+ +
+ PDF Filler +
+ +
+ Genesis Tech +
+ +
+ Spryker +
+ +
+ 2 Amigos +
+ +
+ Magma Digital +
+ +
+ Magma Digital +
\ No newline at end of file diff --git a/_includes/doc_1.8.html b/_includes/doc_1.8.html deleted file mode 100644 index 69ce923b9..000000000 --- a/_includes/doc_1.8.html +++ /dev/null @@ -1 +0,0 @@ -
You are viewing documentation for Codeception 1.8. Switch to latest stable »
\ No newline at end of file diff --git a/_includes/doc_2.0.html b/_includes/doc_2.0.html deleted file mode 100644 index dda632ecf..000000000 --- a/_includes/doc_2.0.html +++ /dev/null @@ -1 +0,0 @@ -
You are viewing documentation for Codeception 2.0. Switch to latest stable »
\ No newline at end of file diff --git a/_includes/extensions.md b/_includes/extensions.md index 57651c89f..0552d693e 100644 --- a/_includes/extensions.md +++ b/_includes/extensions.md @@ -1,6 +1,44 @@ # Official Extensions -## Codeception\Extension\Logger +## DotReporter + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/DotReporter.php) + +DotReporter provides less verbose output for test execution. +Like PHPUnit printer it prints dots "." for successful tests and "F" for failures. + +![](https://cloud.githubusercontent.com/assets/220264/26132800/4d23f336-3aab-11e7-81ba-2896a4c623d2.png) + +```bash + .......... + .......... + .......... + .......... + .......... + .......... + .......... + .......... + +Time: 2.07 seconds, Memory: 20.00MB + +OK (80 tests, 124 assertions) +``` + + +Enable this reporter with `--ext option` + +``` +codecept run --ext DotReporter +``` + +Failures and Errors are printed by a standard Codeception reporter. +Use this extension as an example for building custom reporters. + + + +## Logger + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/Logger.php) Log suites/tests/steps using Monolog library. Monolog should be installed additionally by Composer. @@ -9,7 +47,8 @@ Monolog should be installed additionally by Composer. composer require monolog/monolog ``` -Steps are logged into `tests/_output/codeception.log` +Codeception's core/internal stuff is logged into `tests/_output/codeception.log`. +Test suites' steps are logged into `tests/_output/-.log`. To enable this module add to your `codeception.yml`: @@ -25,43 +64,100 @@ extensions: -## Codeception\Extension\Recorder +## Recorder -Saves screenshots of each step in acceptance tests and shows them as a slideshow. -Activated only for suites with WebDriver module enabled. +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/Recorder.php) - ![recorder](http://codeception.com/images/recorder.gif) +Saves a screenshot of each step in acceptance tests and shows them as a slideshow on one HTML page (here's an [example](https://codeception.com/images/recorder.gif)). +Works only for suites with WebDriver module enabled. -Slideshows saves are saved into `tests/_output/record_*` directories. -Open `index.html` to see the slideshow. +The screenshots are saved to `tests/_output/record_*` directories, open `index.html` to see them as a slideshow. #### Installation -Add to list of enabled extensions +Add this to the list of enabled extensions in `codeception.yml` or `Acceptance.suite.yml`: ``` yaml extensions: - enabled: [Codeception\Extension\Recorder] + enabled: + - Codeception\Extension\Recorder ``` #### Configuration -* `delete_successful` (default: true) - delete records for successfully passed tests (log only failed and errored) -* `module` (default: WebDriver) - which module for screenshots to use. Module should implement `Codeception\Lib\Interfaces\ScreenshotSaver` interface. Currently only WebDriver or any its children can be used. +* `delete_successful` (default: true) - delete screenshots for successfully passed tests (i.e. log only failed and errored tests). +* `module` (default: WebDriver) - which module for screenshots to use. Set `AngularJS` if you want to use it with AngularJS module. Generally, the module should implement `Codeception\Lib\Interfaces\ScreenshotSaver` interface. +* `ignore_steps` (default: []) - array of step names that should not be recorded (given the step passed), * wildcards supported. Meta steps can also be ignored. +* `success_color` (default: success) - bootstrap values to be used for color representation for passed tests +* `failure_color` (default: danger) - bootstrap values to be used for color representation for failed tests +* `error_color` (default: dark) - bootstrap values to be used for color representation for scenarios where there's an issue occurred while generating a recording +* `delete_orphaned` (default: false) - delete recording folders created via previous runs +* `include_microseconds` (default: false) - enable microsecond precision for recorded step time details + +#### Examples: ``` yaml extensions: - config: - Codeception\Extension\Recorder: - delete_successful: false + enabled: + - Codeception\Extension\Recorder: + module: AngularJS # enable for Angular + delete_successful: false # keep screenshots of successful tests + ignore_steps: [have, grab*] +``` +#### Skipping recording of steps with annotations + +It is also possible to skip recording of steps for specified tests by using the `@skipRecording` annotation. + +```php +/** +* @skipRecording login +* @skipRecording amOnUrl +*\/ +public function testLogin(AcceptanceTester $I) +{ + $I->login(); + $I->amOnUrl('https://codeception.com'); +} +``` + + + +## RunBefore + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunBefore.php) + +Extension for execution of some processes before running tests. + +Processes can be independent and dependent. +Independent processes run independently of each other. +Dependent processes run sequentially one by one. + +Can be configured in suite config: + +```yaml +# acceptance.suite.yml +extensions: + enabled: + - Codeception\Extension\RunBefore: + - independent_process_1 + - + - dependent_process_1_1 + - dependent_process_1_2 + - independent_process_2 + - + - dependent_process_2_1 + - dependent_process_2_2 ``` +HINT: you can use different configurations per environment. -## Codeception\Extension\RunFailed +## RunFailed -Saves failed tests into tests/log/failed in order to rerun failed tests. +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunFailed.php) + +Saves failed tests into `tests/_output/failed` in order to rerun failed tests. To rerun failed tests just run the `failed` group: @@ -69,7 +165,13 @@ To rerun failed tests just run the `failed` group: php codecept run -g failed ``` -Starting from Codeception 2.1 **this extension is enabled by default**. +To change failed group name add: +``` +--override "extensions: config: Codeception\Extension\RunFailed: fail-group: another_group1" +``` +Remember: If you run tests and they generated custom-named fail group, to run this group, you should add override too + +**This extension is enabled by default.** ``` yaml extensions: @@ -80,10 +182,64 @@ On each execution failed tests are logged and saved into `tests/_output/failed` -## Codeception\Extension\SimpleOutput +## RunProcess + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/RunProcess.php) + +Extension to start and stop processes per suite. +Can be used to start/stop selenium server, chromedriver, etc. +Each command is executed only once, at the beginning of the test suite. To execute a command before each test, see [Before/After Attributes](https://codeception.com/docs/AdvancedUsage#BeforeAfter-Attributes). + +Can be enabled in suite config: + +```yaml +# Acceptance.suite.yml +extensions: + enabled: + - Codeception\Extension\RunProcess: + - chromedriver +``` + +Multiple parameters can be passed as array: + +```yaml +# Acceptance.suite.yml +extensions: + enabled: + - Codeception\Extension\RunProcess: + - php -S 127.0.0.1:8000 -t tests/data/app + - java -jar ~/selenium-server.jar +``` + +In the end of a suite all launched processes will be stopped. + +To wait for the process to be launched use the `sleep` option. In this case you need configuration to be specified as object: + +```yaml +extensions: + enabled: + - Codeception\Extension\RunProcess: + 0: php -S 127.0.0.1:8000 -t tests/data/app + 1: java -jar ~/selenium-server.jar + sleep: 5 # wait 5 seconds for the processes to boot +``` + +HINT: You can use different configurations per environment. + + + +## SimpleReporter + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/SimpleReporter.php) This extension demonstrates how you can implement console output of your own. Recommended to be used for development purposes only. +## SuiteInitSubscriberTrait + +[See Source](https://github.com/Codeception/Codeception/blob/main/ext/SuiteInitSubscriberTrait.php) + + + diff --git a/_includes/frameworks.html b/_includes/frameworks.html new file mode 100644 index 000000000..e8e305b13 --- /dev/null +++ b/_includes/frameworks.html @@ -0,0 +1,35 @@ + + diff --git a/_includes/guides.html b/_includes/guides.html index 5db6bd4f3..040143aef 100644 --- a/_includes/guides.html +++ b/_includes/guides.html @@ -1 +1,17 @@ -
  • Introduction
  • Getting Started
  • Acceptance Tests
  • Functional Tests
  • Unit Tests
  • Reusing Test Code
  • Advanced Usage
  • Customization
  • Data
  • Web Services
  • Codecoverage
  • Parallel Execution
  • Nettuts+ Video Course
  • +
  • Introduction
  • +
  • Getting Started
  • +
  • Acceptance Tests
  • +
  • Functional Tests
  • +
  • Unit Tests
  • +
  • Debugging
  • +
  • Modules And Helpers
  • +
  • Reusing Test Code
  • +
  • Advanced Usage
  • +
  • BDD
  • +
  • Customization
  • +
  • Data
  • +
  • API Testing
  • +
  • Codecoverage
  • +
  • Reporting
  • +
  • Continuous Integration
  • +
  • Parallel Execution
  • \ No newline at end of file diff --git a/_includes/hero.html b/_includes/hero.html new file mode 100644 index 000000000..b63456449 --- /dev/null +++ b/_includes/hero.html @@ -0,0 +1,19 @@ +
    +
    +
    + code example +

    PHP Testing for
    everyone_

    +

    + Codeception collects and shares best practices and solutions for testing PHP web applications. With a + flexible + set of included modules tests are easy to write, easy to use and easy to maintain.
    +

    + +
    +
    +
    diff --git a/_includes/joomla_hero.html b/_includes/joomla_hero.html new file mode 100644 index 000000000..efea67de8 --- /dev/null +++ b/_includes/joomla_hero.html @@ -0,0 +1,14 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Joomla +

    +
    +
    +
    +
    +
    diff --git a/_includes/js.html b/_includes/js.html new file mode 100644 index 000000000..8bee78f05 --- /dev/null +++ b/_includes/js.html @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/_includes/laravel_hero.html b/_includes/laravel_hero.html new file mode 100644 index 000000000..fad0bacef --- /dev/null +++ b/_includes/laravel_hero.html @@ -0,0 +1,14 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Laravel Framework Laravel +

    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/_includes/modules.html b/_includes/modules.html index 9337b3798..1a27a238f 100644 --- a/_includes/modules.html +++ b/_includes/modules.html @@ -1 +1,26 @@ -
  • AMQP
  • PhpBrowser
  • Asserts
  • Queue
  • Cli
  • REST
  • Db
  • Redis
  • Dbh
  • SOAP
  • Doctrine2
  • Sequence
  • FTP
  • Silex
  • Facebook
  • Symfony2
  • Filesystem
  • WebDriver
  • Laravel4
  • XMLRPC
  • Laravel5
  • Yii1
  • Lumen
  • Yii2
  • Memcache
  • ZF1
  • MongoDb
  • ZF2
  • Phalcon1
  • ZendExpressive
  • Phalcon2
  • \ No newline at end of file +
  • AMQP
  • +
  • Apc
  • +
  • Asserts
  • +
  • Cli
  • +
  • DataFactory
  • +
  • Db
  • +
  • Doctrine
  • +
  • FTP
  • +
  • Filesystem
  • +
  • Laminas
  • +
  • Laravel
  • +
  • Lumen
  • +
  • Memcache
  • +
  • Mezzio
  • +
  • MongoDb
  • +
  • Phalcon
  • +
  • Phalcon 4
  • +
  • PhpBrowser
  • +
  • Queue
  • +
  • Redis
  • +
  • REST
  • +
  • Sequence
  • +
  • SOAP
  • +
  • Symfony
  • +
  • WebDriver
  • +
  • Yii2
  • diff --git a/_includes/phalcon_hero.html b/_includes/phalcon_hero.html new file mode 100644 index 000000000..5ae0f4a36 --- /dev/null +++ b/_includes/phalcon_hero.html @@ -0,0 +1,13 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Phalcon

    +
    +
    +
    +
    +
    diff --git a/_includes/phar.html b/_includes/phar.html new file mode 100644 index 000000000..203c45952 --- /dev/null +++ b/_includes/phar.html @@ -0,0 +1,110 @@ +
    +
    + +
    +
    +
    +
    + Download +
    +
    +
    +
    wget https://codeception.com/php80/codecept.phardownload 
    +
    +
    +
    +

    + Execute it as + php codecept.phar

    +
    +
    +
    +
    + +
    +
    +
    +
    + Download +
    +
    +
    +
    wget https://codeception.com/codecept.phardownload 
    +
    +
    +
    +

    + Execute it as + php codecept.phar

    +
    +
    +
    +
    + +
    +
    +
    +
    + Download +
    +
    +
    +
    wget https://codeception.com/php56/codecept.phardownload 
    +
    +
    +
    +

    + Execute it as + php codecept.phar

    +
    +
    +
    +
    + +
    +
    +
    +
    sudo curl -LsS https://codeception.com/php80/codecept.phar -o /usr/local/bin/codecept
    +
    sudo chmod a+x /usr/local/bin/codecept
    +
    +

    + Execute it as + codecept

    +
    +
    +
    +
    \ No newline at end of file diff --git a/_includes/reference.html b/_includes/reference.html index c11e33fa6..0e8a7cfc8 100644 --- a/_includes/reference.html +++ b/_includes/reference.html @@ -1 +1,11 @@ -
  • Installation
  • Changelog
  • Autoload
  • Commands
  • Configuration
  • Fixtures
  • Functions
  • JsonType
  • Locator
  • Stub
  • XmlBuilder
  • +
  • Autoload
  • +
  • Fixtures
  • +
  • Functions
  • +
  • HttpCode
  • +
  • InitTemplate
  • +
  • JsonType
  • +
  • Locator
  • +
  • Mock
  • +
  • Module
  • +
  • Stub
  • +
  • XmlBuilder
  • \ No newline at end of file diff --git a/_includes/rss.html b/_includes/rss.html index 2c6815c48..ba7ed178d 100644 --- a/_includes/rss.html +++ b/_includes/rss.html @@ -1,21 +1,22 @@ - {{ site.title }} - - + {{ site.title }} + + + {{ site.time | date_to_xmlschema }} + {{ site.url }} + + Michael Bodnarchuk "Davert" + + Copyright (c) Codeception - {{ site.time | date_to_xmlschema }} - {{ site.url }} - Michael Bodnarchuk "Davert" - Copyright (c) Codeception - - {% for post in site.posts limit:30 %} - - {{ post.title }} - - {{ post.date | date_to_xmlschema }} - {{ site.url }}{{ post.url }}/ - {{ post.content | strip_html | truncatewords: 20 }} - - {% endfor %} + {% for post in site.posts limit:30 %} + + {{ post.title }} + + {{ post.date | date_to_xmlschema }} + {{ site.url }}{{ post.url }}/ + {{ post.content | strip_html | truncatewords: 20 }} + + {% endfor %} \ No newline at end of file diff --git a/_includes/sponsors.html b/_includes/sponsors.html new file mode 100644 index 000000000..788179c46 --- /dev/null +++ b/_includes/sponsors.html @@ -0,0 +1,40 @@ +
    +
    + + + + + + + + + + + + + + +
    +
    diff --git a/_includes/switch.html b/_includes/switch.html index 895988657..723a5d06f 100644 --- a/_includes/switch.html +++ b/_includes/switch.html @@ -1,5 +1,5 @@ -
    - current (2.1) - 2.0 - 1.8 + diff --git a/_includes/symfony_hero.html b/_includes/symfony_hero.html new file mode 100644 index 000000000..551560d17 --- /dev/null +++ b/_includes/symfony_hero.html @@ -0,0 +1,14 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Symfony Framework +

    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/_includes/toc.html b/_includes/toc.html index bf38919a5..376f34fc4 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -1 +1,24 @@ -
  • AMQP
  • Cli
  • Db
  • Dbh
  • Doctrine1
  • Doctrine2
  • Filesystem
  • Kohana
  • Memcache
  • MongoDb
  • PhpBrowser
  • REST
  • Redis
  • SOAP
  • Selenium
  • Selenium2
  • SocialEngine
  • Symfony1
  • Symfony2
  • Unit
  • WebDebug
  • XMLRPC
  • ZF1
  • ZombieJS
  • \ No newline at end of file +
  • AMQP
  • +
  • Cli
  • +
  • Db
  • +
  • Dbh
  • +
  • Doctrine1
  • +
  • Doctrine2
  • +
  • Filesystem
  • +
  • Kohana
  • +
  • Memcache
  • +
  • MongoDb
  • +
  • PhpBrowser
  • +
  • REST
  • +
  • Redis
  • +
  • SOAP
  • +
  • Selenium
  • +
  • Selenium2
  • +
  • SocialEngine
  • +
  • Symfony1
  • +
  • Symfony2
  • +
  • Unit
  • +
  • WebDebug
  • +
  • XMLRPC
  • +
  • ZF1
  • +
  • ZombieJS
  • \ No newline at end of file diff --git a/_includes/tweets.html b/_includes/tweets.html new file mode 100644 index 000000000..8bb370128 --- /dev/null +++ b/_includes/tweets.html @@ -0,0 +1,82 @@ +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    diff --git a/_includes/twitter.html b/_includes/twitter.html new file mode 100644 index 000000000..da40a33a0 --- /dev/null +++ b/_includes/twitter.html @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/_includes/wp_hero.html b/_includes/wp_hero.html new file mode 100644 index 000000000..504013364 --- /dev/null +++ b/_includes/wp_hero.html @@ -0,0 +1,13 @@ +
    +
    +
    +
    +
    +

    + Codeception for + WordPress

    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/_includes/yii_hero.html b/_includes/yii_hero.html new file mode 100644 index 000000000..67f7fbe11 --- /dev/null +++ b/_includes/yii_hero.html @@ -0,0 +1,14 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Yii Framework +

    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/_includes/zf_hero.html b/_includes/zf_hero.html new file mode 100644 index 000000000..ef3e26f02 --- /dev/null +++ b/_includes/zf_hero.html @@ -0,0 +1,26 @@ +
    +
    +
    +
    +
    +

    + Codeception for + Laravel Framework + Zend Framework 2 +

    +
    +
    +
    +

    ZF2 Module

    +

    Maintainer

    +

    +

    Gintautas Miselis

    +

    GitHub

    +

    naktibalda@

    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/_layouts/bootstrap.html b/_layouts/bootstrap.html index 596e3f941..299f8ffea 100644 --- a/_layouts/bootstrap.html +++ b/_layouts/bootstrap.html @@ -1,212 +1,275 @@ - + {% if page.title %} {{ page.title }} {% else %} - Codeception + Codeception - PHP Testing framework - PHP unit testing, PHP e2e testing, database testing {% endif %} - + + - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + - -{% capture guides %}{% include guides.html %}{% endcapture %} - {% capture modules %}{% include modules.html %}{% endcapture %} - {% capture reference %}{% include reference.html %}{% endcapture %} - +{% if page.hero %} +
    {% include {{ page.hero }} %}
    +{% endif %} + +
    + {{ content }} +
    +{% if page.hero %} +{% include sponsors.html %} +{% endif %} +
    - -