diff --git a/.env b/.env index 1670bdf..c5a03a1 100644 --- a/.env +++ b/.env @@ -1,12 +1,9 @@ -# User and Group settings -# For automatic host user detection, run before docker-compose: -# export USER_ID=$(id -u) && export GROUP_ID=$(id -g) -# Otherwise, these defaults will be used: +# === SYSTEM CONFIGURATION === USER_ID=1000 GROUP_ID=1000 USER_NAME=www-data GROUP_NAME=www-data -# Yii2 environment settings +# === YII2 APPLICATION === YII_DEBUG=true YII_ENV=dev diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8cfb23..0c908e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,5 +24,6 @@ jobs: AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: + codeception-command: vendor/bin/codecept run --env php-builtin --coverage-xml coverage-file: runtime/output/coverage.xml - extensions: gd, intl + extensions: gd, intl, pcov diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 20545be..e017cc0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -39,7 +39,7 @@ jobs: run: docker exec yii2-apache vendor/bin/codecept build - name: Run codeception tests. - run: docker exec yii2-apache vendor/bin/codecept run + run: docker exec yii2-apache vendor/bin/codecept run --env dockerized test-caddy: runs-on: ubuntu-latest @@ -67,7 +67,7 @@ jobs: run: docker exec yii2-caddy vendor/bin/codecept build - name: Run codeception tests. - run: docker exec yii2-caddy vendor/bin/codecept run + run: docker exec yii2-caddy vendor/bin/codecept run --env dockerized test-frankenphp: runs-on: ubuntu-latest @@ -95,7 +95,7 @@ jobs: run: docker exec yii2-frankenphp vendor/bin/codecept build - name: Run codeception tests. - run: docker exec yii2-frankenphp vendor/bin/codecept run + run: docker exec yii2-frankenphp vendor/bin/codecept run --env dockerized test-nginx: runs-on: ubuntu-latest @@ -123,4 +123,4 @@ jobs: run: docker exec yii2-nginx vendor/bin/codecept build - name: Run codeception tests. - run: docker exec yii2-nginx vendor/bin/codecept run + run: docker exec yii2-nginx vendor/bin/codecept run --env dockerized diff --git a/codeception.yml b/codeception.yml index 5732d5a..1f209b7 100644 --- a/codeception.yml +++ b/codeception.yml @@ -3,10 +3,10 @@ bootstrap: _bootstrap.php support_namespace: Support paths: tests: tests - output: public/runtime/output + output: runtime/output data: tests/Support/data support: tests/Support - envs: public/runtime/_envs + envs: tests/_envs actor_suffix: Tester settings: memory_limit: 1024M diff --git a/composer.json b/composer.json index 4a877da..a67d13f 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "ui-awesome/html": "^0.3", "ui-awesome/html-component-bootstrap5": "^1.0@dev", "ui-awesome/html-svg":"^0.2", + "vlucas/phpdotenv": "^5.6", "yii2-extensions/localeurls": "^0.1.0", "yiisoft/yii2": "^2.0.53|^22", "yiisoft/yii2-bootstrap5": "^2.0.50|^22", @@ -26,6 +27,7 @@ "codeception/lib-innerbrowser": "^4.0", "codeception/module-asserts": "^3.0", "codeception/module-filesystem": "^3.0", + "codeception/module-phpbrowser": "^3.0", "codeception/module-yii2": "^1.1", "codeception/verify": "^3.0", "maglnet/composer-require-checker": "^4.6", @@ -75,6 +77,6 @@ "ecs": "./vendor/bin/ecs --fix", "rector": "./vendor/bin/rector process src", "static": "./vendor/bin/phpstan analyse src --memory-limit=512M", - "tests": "./vendor/bin/codecept run" + "tests": "./vendor/bin/codecept run --env php-builtin" } } diff --git a/composer.lock b/composer.lock index 42c15b7..f885f5d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "53e1879ad59572550fd6803faa3cf37a", + "content-hash": "a00d0ea1f531a8651ce8f8e80bbe8df3", "packages": [ { "name": "cebe/markdown", @@ -958,6 +958,68 @@ }, "time": "2024-11-01T03:51:45+00:00" }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:45:45+00:00" + }, { "name": "justinrainbow/json-schema", "version": "6.4.2", @@ -1228,6 +1290,81 @@ ], "time": "2025-03-13T13:03:07+00:00" }, + { + "name": "phpoption/phpoption", + "version": "1.9.3", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2024-07-20T21:41:07+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -3760,6 +3897,90 @@ }, "time": "2024-03-31T13:02:29+00:00" }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.2", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af", + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.3", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.3", + "symfony/polyfill-ctype": "^1.24", + "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2025-04-30T23:37:27+00:00" + }, { "name": "voku/anti-xss", "version": "4.1.42", @@ -4975,6 +5196,71 @@ }, "time": "2023-12-08T19:23:28+00:00" }, + { + "name": "codeception/module-phpbrowser", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/Codeception/module-phpbrowser.git", + "reference": "a972411f60cd00d00d5e5e3b35496ba4a23bcffc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Codeception/module-phpbrowser/zipball/a972411f60cd00d00d5e5e3b35496ba4a23bcffc", + "reference": "a972411f60cd00d00d5e5e3b35496ba4a23bcffc", + "shasum": "" + }, + "require": { + "codeception/codeception": "*@dev", + "codeception/lib-innerbrowser": "*@dev", + "ext-json": "*", + "guzzlehttp/guzzle": "^7.4", + "php": "^8.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0" + }, + "conflict": { + "codeception/codeception": "<5.0", + "codeception/lib-innerbrowser": "<3.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.199", + "codeception/module-rest": "^2.0 || *@dev", + "ext-curl": "*" + }, + "suggest": { + "codeception/phpbuiltinserver": "Start and stop PHP built-in web server for your tests" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Bodnarchuk" + }, + { + "name": "Gintautas Miselis" + } + ], + "description": "Codeception module for testing web application over HTTP", + "homepage": "https://codeception.com/", + "keywords": [ + "codeception", + "functional-testing", + "http" + ], + "support": { + "issues": "https://github.com/Codeception/module-phpbrowser/issues", + "source": "https://github.com/Codeception/module-phpbrowser/tree/3.0.1" + }, + "time": "2023-12-08T19:41:28+00:00" + }, { "name": "codeception/module-yii2", "version": "1.1.12", @@ -5126,6 +5412,215 @@ }, "time": "2025-04-16T07:12:02+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2025-03-27T13:37:11+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c", + "reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.2.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2025-03-27T13:27:01+00:00" + }, { "name": "guzzlehttp/psr7", "version": "2.7.1", @@ -6157,16 +6652,16 @@ }, { "name": "phpunit/phpunit", - "version": "12.2.6", + "version": "12.2.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "638644c62a58f04974da115f98981c9b48564021" + "reference": "8b1348b254e5959acaf1539c6bd790515fb49414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/638644c62a58f04974da115f98981c9b48564021", - "reference": "638644c62a58f04974da115f98981c9b48564021", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8b1348b254e5959acaf1539c6bd790515fb49414", + "reference": "8b1348b254e5959acaf1539c6bd790515fb49414", "shasum": "" }, "require": { @@ -6176,7 +6671,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.1", + "myclabs/deep-copy": "^1.13.3", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.3", @@ -6234,7 +6729,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.2.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.2.7" }, "funding": [ { @@ -6258,7 +6753,59 @@ "type": "tidelift" } ], - "time": "2025-07-04T06:00:16+00:00" + "time": "2025-07-11T04:11:13+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", diff --git a/public/index.php b/public/index.php index 6f6f2bd..e8074db 100644 --- a/public/index.php +++ b/public/index.php @@ -2,10 +2,12 @@ declare(strict_types=1); -use yii\web\Application; +require_once __DIR__ . '/../vendor/autoload.php'; +require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; -defined('YII_DEBUG') || define('YII_DEBUG', false); -defined('YII_ENV') || define('YII_ENV', 'prod'); +// Load environment variables from .env file +$dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__)); +$dotenv->safeLoad(); if (getenv('YII_C3')) { $c3 = dirname(__DIR__) . '/c3.php'; @@ -15,10 +17,7 @@ } } -require_once __DIR__ . '/../vendor/autoload.php'; -require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; - $config = require dirname(__DIR__) . '/config/web/app.php'; -$app = new Application($config); +$app = new yii\web\Application($config); $app->run(); diff --git a/tests/Acceptance.suite.yml b/tests/Acceptance.suite.yml index 41b4461..03e52e8 100644 --- a/tests/Acceptance.suite.yml +++ b/tests/Acceptance.suite.yml @@ -4,14 +4,8 @@ # Perform tests in browser using the WebDriver or PhpBrowser. # If you need both WebDriver and PHPBrowser tests - create a separate suite. actor: AcceptanceTester -extensions: - enabled: - - Codeception\Extension\RunProcess: - 0: ./yii serve - sleep: 1 modules: enabled: - - Filesystem - - Yii2 - - Asserts + - PhpBrowser: + url: localhost:8080 step_decorators: ~ diff --git a/tests/Acceptance/AboutCest.php b/tests/Acceptance/AboutCest.php index 509df46..353da36 100644 --- a/tests/Acceptance/AboutCest.php +++ b/tests/Acceptance/AboutCest.php @@ -11,7 +11,7 @@ final class AboutCest public function aboutPage(AcceptanceTester $I): void { $I->amGoingTo('navigate to the About page.'); - $I->amOnRoute('site/about'); + $I->amOnPage('site/about'); $I->wantTo('ensure that About page works.'); diff --git a/tests/Acceptance/ContactCest.php b/tests/Acceptance/ContactCest.php index acfb3ca..617693a 100644 --- a/tests/Acceptance/ContactCest.php +++ b/tests/Acceptance/ContactCest.php @@ -11,7 +11,7 @@ final class ContactCest public function contactPage(AcceptanceTester $I): void { $I->amGoingTo('navigate to the Contact page.'); - $I->amOnRoute('contact/index'); + $I->amOnPage('contact/index'); $I->wantTo('ensure that Contact page works.'); diff --git a/tests/Acceptance/SiteCest.php b/tests/Acceptance/SiteCest.php index f165f0a..95bf6ff 100644 --- a/tests/Acceptance/SiteCest.php +++ b/tests/Acceptance/SiteCest.php @@ -11,7 +11,7 @@ final class SiteCest public function homePage(AcceptanceTester $I): void { $I->amGoingTo('navigate to the Home page.'); - $I->amOnRoute('/'); + $I->amOnPage('/'); $I->wantTo('ensure that Home page works.'); diff --git a/tests/Functional.suite.yml b/tests/Functional.suite.yml index 3e33c70..a9fc97f 100644 --- a/tests/Functional.suite.yml +++ b/tests/Functional.suite.yml @@ -7,7 +7,7 @@ actor: FunctionalTester modules: enabled: - - Filesystem - - Yii2 - - Asserts + - Filesystem + - Yii2 + - Asserts step_decorators: ~ diff --git a/tests/Functional/SiteCest.php b/tests/Functional/SiteCest.php new file mode 100644 index 0000000..39dc2d8 --- /dev/null +++ b/tests/Functional/SiteCest.php @@ -0,0 +1,25 @@ +amGoingTo('navigate to the Home page.'); + $I->amOnPage('/'); + + $I->wantTo('ensure that Home page works.'); + + $I->seeResponseCodeIs(200); + $I->expectTo('see page index.'); + $I->seeInTitle('Index'); + $I->seeElement('body'); + $I->see('Web Application', 'h1'); + $I->see('English'); + } +} diff --git a/tests/Unit.suite.yml b/tests/Unit.suite.yml index b1b434e..c819da1 100644 --- a/tests/Unit.suite.yml +++ b/tests/Unit.suite.yml @@ -4,7 +4,7 @@ actor: UnitTester modules: enabled: - - Asserts - - Yii2: + - Asserts + - Yii2: part: [orm, email, fixtures] step_decorators: ~ diff --git a/tests/_envs/dockerized.yml b/tests/_envs/dockerized.yml new file mode 100644 index 0000000..546f0cc --- /dev/null +++ b/tests/_envs/dockerized.yml @@ -0,0 +1,4 @@ +modules: + config: + PhpBrowser: + url: https://localhost:443 diff --git a/tests/_envs/php-builtin.yml b/tests/_envs/php-builtin.yml new file mode 100644 index 0000000..929ab08 --- /dev/null +++ b/tests/_envs/php-builtin.yml @@ -0,0 +1,9 @@ +extensions: + enabled: + - Codeception\Extension\RunProcess: + 0: php -d variables_order=EGPCS -S localhost:8085 -t public + sleep: 1 +modules: + config: + PhpBrowser: + url: http://localhost:8085