Development environment
Setting up a development environment for CMSimple_XH is quite simple: a web server with PHP support and the CMSimple_XH sources are already sufficient. Of course, a suitable editor is also needed. If the own designs should also flow into the general development of CMSimple_XH, an additional Git client is needed.
Requirements
- CMSimple_XH 1.7 and higher
- PHP ≥ 5.6, inclusive Interactive PHP Debugger (phpdbg)
- Web server
- Git-Client (on Windows TortoiseGit is recommended, alternatively GitHub Desktop)
To use the CMSimple_XH build system (recommended), the following components are also required:
- Composer
- for PHP 5: runkit (runkit ≥ 1.0.4 für XH 1.7);
for PHP 7: uopz (only for XH ≥1.7) - Doxygen
- Node.js with npm
- JSDoc 3
All other development dependencies are installed via Composer.
Optional: Phan, which requires PHP 7.1 and the php-ast extension.
Setup
- install PHP and the web server
- for PHP 5: install runkit, and add
runkit.internal_override = 1
to php.ini;
for PHP 7: install uopz - for XH 1.6: install phpDocumentor 1;
for XH 1.7: install Doxygen - install Node.js
- install JSDoc 3
- install Composer
- clone the CMSimple_XH repo from Github
- run composer install in the root directory of the cloned repo
- add vendor/bin to PATH (on Windows: .\vendor\bin)
Phing Targets
The CMSimple_XH build system is supported by Phing and provides several targets, which are described below. A short help on the available targets can be obtained by running phing without parameters.
Static code analysis
phing sniff
Checks the core and internal plugins (filebrowser, meta_tags and page_params) for violations of the encoding standard.
phing mess
Checks for unused code. Only available in master, but not in release branches before 1.6.
phing compat
Checks the core and default plugins for compatibility with different PHP versions.
phing phan
Performs a general static code analysis. For this target, the phan command must be present in the path.
Test Suites
phing unit-tests
Runs the unit test suite. Currently, this requires a “correct” configuration, in particular language_default must be set to 'en'.
phing attack-tests
Runs the attack test suite. To do this, the CMSIMPLEDIR environment variable must be set to the URL path of the development installation. For example, if the URL is http://localhost/xh/, CMSIMPLEDIR must be set to /xh/ (note the leading and trailing slashes).
phing validation-tests
Runs the validation test suite. CMSIMPLEDIR must be set accordingly (see above). Note that this test suite uses the W3C-Validator, so the tests may sometimes fail because this service is not available.
phing all-tests
Short command to run all three test suites.
Code verification
phing coverage
Generates a code review test report based on the unit test suite. The report is located in tests/unit/coverage/.
Documentation
phing php-doc
Creates the PHP documentation from the sources and tutorials in tutorials/. The documentation is then located in doc/php/.
phing js-doc
Generates the JS documentation from the sources. It is located in doc/js/.
phing doc
A shortcut to create the PHP and JS documentation.
Building
phing -Dversion=<version> build
Creates the complete installation package as a ZIP archive in the root directory, ready for publishing.
phing -Dversion=<version> -Dpatchee=<filename> build-patch
Creates an update package as a ZIP archive in the root folder, ready for publishing. <filename> should be the filename of the full installation package of the version for which the patch is to be built.
So, for example, if CMSimple_XH 1.7.6 is to be released, we run the following:
phing -Dversion="1.7.6" build phing -Dversion="1.7.6" -Dpatchee="CMSimple_XH-1.7.zip" build-patch mv "CMSimple_XH-1.7.6-patch.zip" "CMSimple_XH-update-1.7-to-1.7.6.zip" phing -Dversion="1.7.6" -Dpatchee="CMSimple_XH-1.7.5.zip" build-patch mv "CMSimple_XH-1.7.6-patch.zip" "CMSimple_XH-update-1.7.5-to-1.7.6.zip"
Troubleshooting
If you have problems setting up the development environment or running the phing targets, you can contact other developers in the Open Development section of the CMSimple_XH forum. In particular, take a look at the thread “How I ride the bullet – How I set up a testing environment?”
Glossary
Filebrowser
Plugin to manage user files. Filebrowser is the standard file manager of CMSimple_XH.
PHP
PHP = Hypertext Preprocessor, originally Personal Home Page Tools
PHP is a scripting language commonly used to create dynamic websites.
ZIP
The ZIP file format allows lossless compression of files incl. entire directories. The reduced file sizes are well suited for archiving or online data transfer (upload/download).