mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 12:48:24 +01:00
Deltik
b18ef3f830
Ready for testing!
e107 is now ready for fully automated testing on all three test suites: * Acceptance * Functional * Unit New features: * cPanelDeployer adds a cPanel Remote MySQL access host * e107 database dump importer * Unit tests now load e107 Fixes: * Test prefixes now only use characters valid for MySQL/MariaDB without escaping * Refactored a bunch of things * All existing tests pass now Changes: * Deployers now provided by \Helper\DeployerFactory * Added Twig templating for generating e107_config.php for testing * cPanelDeployer now outputs to codecept_debug()
e107 Test Suites
For developmental use with e107 v2.
- Place all these files inside a 'phpunit' directory in e107's root directory. ie. the same directory as class2.php
- Set the Custom Working Directory for PHPUNit Test to e107's root. eg. In PHPStorm under "Run/Debug Configurations"
Automatic Acceptance Tests
The acceptance test suite can deploy itself onto a cPanel account automatically.
Requirements
- cPanel user account – It is recommended to use a cPanel account dedicated to testing for isolation, but the test suite runs on most typical accounts and tries not to interfere with existing data.
- Resolvable main domain – The cPanel account's main domain must be resolvable to the machine running the test suite. This usually means that the domain must resolve on the Internet.
- MariaDB database quota – Each run of the test suite creates one new MariaDB database and deletes it after executing the suite.
- 64MiB free disk space – The test suite archives a copy of the app and uploads it to the cPanel account for cPanel to extract. The app, its archive form, and test resources may grow in the future, so the more free disk space, the better.
- 4096 free inodes – The app and test resources will take up at least a few thousand inodes and may need more in the future, so the more free inodes, the better.
Limitations
- PHP version cannot be set – The test suite currently does not have the ability to set custom versions of PHP for the target app directory. If the cPanel host supports multiple versions of PHP (e.g. EasyApache 4 MultiPHP, CloudLinux alt-php), they will have to be configured manually to test different PHP versions.
- MariaDB username character limit – cPanel MariaDB usernames are limited to 47 characters in length, and test runs are expected to use 18 plus the length of your cPanel username plus 1.
- MariaDB database character limit – cPanel MariaDB databases are limited to 64 characters in length, and test runs are expected to use 18 plus the length of your cPanel username plus 4. (cPanel double-counts underscores (
_
) and the deployer uses 2 underscores, so the visible character count is 2 less than what cPanel counts.) - MariaDB remote access host
%
is preserved on crash – The deployer adds a cPanel Remote MySQL® access host,%
, but will forget to remove it if the test run is uncleanly aborted. Subsequent runs will not touch the%
remote access host because the deployer would not be sure if it added%
. - cPanel max POST size – The cPanel PHP maximum POST request size can be as low as 55MiB on some hosts. If the app's archive form exceeds this size, the upload will fail. This limit can be adjusted in the hosting provider's server-wide WHM settings.
Configuration
To run automatic acceptance tests, edit secrets.yml
in the root folder of this repository and input the following configuration information:
cpanel:
enabled: true
hostname: 'SHARED-HOSTNAME.YOUR-HOSTING-PROVIDER.EXAMPLE'
username: 'TEST-ACCOUNT-USER'
password: 'TEST-ACCOUNT-PASS'
Manual Acceptance Tests
If you do not have a cPanel account that meets the requirements, you can run acceptance tests manually.
Configuration
- Set up a web server wherever you can access. A local web server is fine.
- Create a MySQL or MariaDB database.
- Create a MySQL or MariaDB user.
- Grant the MySQL/MariaDB user
ALL PRIVILEGES
on the MySQL/MariaDB database. - Put the app on the web server and note its URL.
- Write the URL to
tests/acceptance.suite.yml
in your copy of this repository where theurl
setting for thePhpBrowser
module is. - Write the database configuration to
codeception.yml
in your copy of this repository under the\Helper\DelayedDb
module.
Languages
PHP
82.8%
JavaScript
9%
CSS
7.7%
HTML
0.2%
BitBake
0.1%
Other
0.1%