-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Enhance environment configuration and testing setup with new .env variables and Codeception adjustments. #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nv variables and Codeception adjustments.
|
Warning Rate limit exceeded@terabytesoftw has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 37 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughThis update introduces several configuration changes and dependency updates across the application and its test infrastructure. It adds new environment-specific Codeception configurations, updates Composer dependencies, refines test suite setups, and modifies workflow files to support new testing environments and coverage reporting. The application bootstrap now loads environment variables using Dotenv. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant WebServer (public/index.php)
participant Dotenv
participant Yii Application
User->>WebServer (public/index.php): HTTP Request
WebServer->>Dotenv: Load .env variables
Dotenv-->>WebServer: Environment variables loaded
WebServer->>Yii Application: Bootstrap and run
Yii Application-->>User: Serve response
sequenceDiagram
participant CI Workflow
participant Codeception
participant PHP Built-in Server
participant PhpBrowser
CI Workflow->>PHP Built-in Server: Start server (via RunProcess)
CI Workflow->>Codeception: Run tests with --env php-builtin
Codeception->>PhpBrowser: Send requests to http://localhost:8085
PhpBrowser->>PHP Built-in Server: HTTP requests
PHP Built-in Server-->>PhpBrowser: Responses
PhpBrowser-->>Codeception: Test results
Codeception-->>CI Workflow: Coverage XML, results
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 36 36
===========================================
Files 23 23
Lines 621 621
===========================================
Hits 621 621 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…TTPS on port 8443.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (2)
tests/Unit.suite.yml (1)
7-9: Indentation tweak is harmless but keep YAML style consistentThe additional two-space indent under
enabled:is accepted by the parser, yet other suite files still keep the original two-space indentation. Consider staying consistent project-wide to avoid “noise-only” diffs in the future.composer.json (1)
30-30: Confirm module-version compatibility with Codeception 5
codeception/module-phpbrowser3.x is compatible, but only starting with 3.1.0 are some PHP 8.3 fixes present. Consider pinning^3.1to avoid unexpected test breakage on future PHP bumps.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (17)
.env(1 hunks).github/workflows/build.yml(1 hunks).github/workflows/docker.yml(4 hunks)codeception.yml(1 hunks)composer.json(2 hunks)public/index.php(2 hunks)tests/Acceptance.suite.yml(1 hunks)tests/Acceptance/AboutCest.php(1 hunks)tests/Acceptance/ContactCest.php(1 hunks)tests/Acceptance/SiteCest.php(1 hunks)tests/Functional.suite.yml(1 hunks)tests/Unit.suite.yml(1 hunks)tests/_envs/apache.yml(1 hunks)tests/_envs/caddy.yml(1 hunks)tests/_envs/frankenphp.yml(1 hunks)tests/_envs/nginx.yml(1 hunks)tests/_envs/php-builtin.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
.env (1)
Learnt from: terabytesoftw
PR: yii2-extensions/app-basic#102
File: docker/apache/Dockerfile:0-0
Timestamp: 2025-07-10T13:59:10.805Z
Learning: In docker/apache/Dockerfile, the queue.conf copy command is intentionally commented out because yii2-queue is optional. Users should uncomment the line `COPY docker/apache/supervisord/conf.d/queue.conf /etc/supervisor/conf.d/queue.conf` only if they install yii2-queue.
composer.json (2)
Learnt from: terabytesoftw
PR: yii2-extensions/app-basic#97
File: docs/installation.md:5-8
Timestamp: 2025-07-09T14:52:41.210Z
Learning: The Yii2 framework has multiple active branches including the 2.0.x branch (maintenance/LTS) and the 22.0 branch (development). When specifying version requirements, "2.0.53+ or 22.x" is accurate and should not be changed to only reference the 2.x branch.
Learnt from: terabytesoftw
PR: yii2-extensions/app-basic#97
File: docs/installation.md:5-8
Timestamp: 2025-07-09T14:52:41.210Z
Learning: The Yii2 framework has multiple active branches including the 2.0.x branch (maintenance/LTS) and the 22.0 branch (development). When specifying version requirements, "2.0.53+ or 22.x" is accurate and should not be changed to only reference the 2.x branch.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: codeception / PHP 8.3-windows-latest
- GitHub Check: codeception / PHP 8.4-windows-latest
- GitHub Check: codeception / PHP 8.1-windows-latest
- GitHub Check: test-frankenphp
- GitHub Check: test-caddy
🔇 Additional comments (14)
.env (1)
1-10: Dotenv values are loaded as strings – double-check boolean handling
YII_DEBUG=trueandYII_ENV=devwill arrive in PHP as the string"true"/"dev".
Unlesspublic/index.phpexplicitly normalises these (e.g.filter_var($_ENV['YII_DEBUG'], FILTER_VALIDATE_BOOLEAN)),define('YII_DEBUG', 'true')will evaluate totruebut may confuse type-sensitive checks and IDEs.Request verification: ensure the bootstrap casts to boolean / enum as intended.
composer.json (1)
18-18: 👍 Dotenv dependency makes sense
No issues spotted withvlucas/phpdotenv:^5.6; it supports PHP 8.1+.tests/_envs/nginx.yml (1)
1-6: Verify SSL certificate setup for localhost HTTPS testing.The configuration uses HTTPS with localhost:8446 and enables SSL. Ensure that:
- Valid SSL certificates are available for localhost testing
- Self-signed certificates are properly configured if used
- The testing environment can handle SSL verification
Consider adding SSL verification settings if needed:
modules: config: PhpBrowser: url: https://localhost:8446 ssl: true + curl: + CURLOPT_SSL_VERIFYPEER: false + CURLOPT_SSL_VERIFYHOST: falsetests/Functional.suite.yml (1)
10-12: LGTM! Improved YAML formatting consistency.The indentation change from 2 to 4 spaces improves YAML formatting consistency and readability.
codeception.yml (2)
6-6: Good security improvement: moving output out of public directory.Moving the output directory from
public/runtime/outputtoruntime/outputprevents test artifacts from being accessible via web requests.
9-9: ✅ Verifiedtests/_envsDirectory StructureThe
tests/_envsdirectory exists and contains the expected YAML files:
- tests/_envs/apache.yml
- tests/_envs/caddy.yml
- tests/_envs/frankenphp.yml
- tests/_envs/nginx.yml
- tests/_envs/php-builtin.yml
No further action required.
tests/Acceptance/SiteCest.php (1)
14-14: LGTM! Correctly updated navigation for PhpBrowser testing.The change from
amOnRoute('/')toamOnPage('/')properly aligns with the switch to PhpBrowser module for URL-based testing instead of Yii2 framework-internal routing.tests/Acceptance/AboutCest.php (1)
14-14: LGTM! Consistent navigation update for PhpBrowser testing.The change from
amOnRoute('site/about')toamOnPage('site/about')maintains consistency with the other acceptance tests and properly supports the PhpBrowser-based testing approach.tests/Acceptance/ContactCest.php (1)
14-14: LGTM! Correct navigation method for PhpBrowser module.The change from
amOnRoutetoamOnPageis appropriate for the switch to PhpBrowser module, as it now uses direct URL navigation instead of Yii2's internal routing system.tests/_envs/apache.yml (1)
1-6: LGTM! Well-configured environment setup for Apache testing.The PhpBrowser configuration with HTTPS and SSL enabled is appropriate for Apache server testing. The port 8443 is a standard choice for HTTPS in development environments.
tests/_envs/php-builtin.yml (1)
1-10: Approve PHP Built-in Server Environment ConfigurationEverything in
tests/_envs/php-builtin.ymllooks correct:
- RunProcess extension starts the PHP built-in server with
variables_order=EGPCS- 1-second sleep gives the server time to spin up
- PhpBrowser points to
http://localhost:8085Please ensure port 8085 is available in your development environment (e.g., via
lsof -i :8085) before running tests..github/workflows/build.yml (1)
27-27: LGTM! Proper integration of new environment configuration into CI.The codeception command correctly specifies the
php-builtinenvironment and enables coverage reporting, which aligns perfectly with the new environment configuration setup..github/workflows/docker.yml (1)
42-42: LGTM! Consistent environment-specific test configuration.The addition of
--envflags to each Codeception test run properly enables environment-specific testing configurations. The implementation is consistent across all four environments (apache, caddy, frankenphp, nginx), which will allow for targeted testing of each Docker setup.Also applies to: 70-70, 98-98, 126-126
public/index.php (1)
26-26: LGTM! Explicit class name usage.Using the fully qualified class name
yii\web\Applicationmakes the dependency explicit and clear.
… of HTTP on port 8080.
…nfiguration and remove obsolete files.
… and streamline index.php loading process.
…t to development.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/Functional/SiteCest.php (1)
11-21: Consider more specific and robust assertions.While the test follows Codeception conventions well, the current assertions are quite basic and potentially fragile:
- The text assertions for "Web Application" and "English" are very generic and might break if the UI changes
- Consider adding more specific assertions like checking page title, HTTP status, or specific HTML elements
- The test lacks validation of critical page elements that would indicate the application is working correctly
Consider enhancing the test with more specific assertions:
public function homePage(FunctionalTester $I): void { $I->amGoingTo('navigate to the Home page.'); $I->amOnPage('/'); + $I->seeResponseCodeIs(200); $I->wantTo('ensure that Home page works.'); $I->expectTo('see page index.'); - $I->see('Web Application'); - $I->see('English'); + $I->seeInTitle('Web Application'); + $I->seeElement('body'); + $I->see('Web Application', 'h1'); + $I->see('English'); }This provides more specific validation while maintaining the same test coverage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/build.yml(1 hunks).github/workflows/docker.yml(4 hunks)public/index.php(2 hunks)tests/Functional/SiteCest.php(1 hunks)tests/_envs/dockerized.yml(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/_envs/dockerized.yml
🚧 Files skipped from review as they are similar to previous changes (3)
- .github/workflows/docker.yml
- public/index.php
- .github/workflows/build.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: codeception / PHP 8.4-windows-latest
- GitHub Check: codeception / PHP 8.2-windows-latest
- GitHub Check: codeception / PHP 8.1-windows-latest
- GitHub Check: codeception / PHP 8.3-windows-latest
- GitHub Check: test-frankenphp
- GitHub Check: test-caddy
🔇 Additional comments (2)
tests/Functional/SiteCest.php (2)
1-7: LGTM: Well-structured file header and imports.The PHP opening tag, strict types declaration, namespace, and import statement follow PHP and PSR-4 best practices correctly.
9-9: Good practice: Final class declaration.Using
finalfor test classes is a good practice that prevents unintended inheritance and maintains test isolation.
Summary by CodeRabbit
New Features
Bug Fixes
Chores