Add tests #67
Replies: 5 comments
-
Run Laravel unit tests?? |
Beta Was this translation helpful? Give feedback.
-
I would think just PHP commands would be sufficient, e.g. |
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks for the insight @AkenRoberts! |
Beta Was this translation helpful? Give feedback.
-
That is like assuming an SQL server is okay by querying its version. |
Beta Was this translation helpful? Give feedback.
-
Right. Maybe more functional tests to ensure PHP is behaving would be useful for a container providing it. I don't see that immediately ('certainly PHP itself is well-tested'), but admittedly that could be naive. Definitely choose the level of testing that ensures the value provided to end users is maintained. 👍🏼 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Order
It would be nice to have each image go through these steps:
What needs to be figured out yet
Helpful resources
Here's some code that was provided by Github for reference:
Other notes
Assertions
PHP is the correct version
Test that PHP is installed and the correct version:
Create a simple PHP script that outputs the PHP version using phpinfo()
Run it inside the container and assert the output is expected
Test that your PHP extensions are enabled:
Create a script that verifies certain extensions are loaded using extension_loaded()
Assert that required extensions like mysqli, mbstring etc are present
Test that Nginx is installed and running:
Use curl to make a request to Nginx from inside the container
Assert that it returns the expected response code and content
Test PHP-FPM is running:
Use ps aux to verify php-fpm process is running
Make a PHP script that connects to php-fpm socket and handles a request
Assert that it works correctly
Test Nginx config is valid:
Use nginx -t to check for valid config
Assert no errors are thrown
Test PHP loads under Nginx:
Add a index.php script
Curl the localhost and verify output
Assert index.php is executed and not downloaded
Example code
Beta Was this translation helpful? Give feedback.
All reactions