If you ever wanted to code in a MVC pattern inside WordPress, now you can!
Using this plugin, you can create controllers (with the same syntax of the WP REST API) that process each request and respond it using a normal WordPress template.
Check our example.
XPress MVC is built from scratch using TDD. Tests are in tests directory. To run them you need to install some requirements and configure the test suite. Follow this instructions:
- Install PHPUnit (https://github.com/sebastianbergmann/phpunit#installation).
- Install WP-CLI (http://wp-cli.org/#install).
- Cd to the plugin's directory.
- Install and configure the test environment running
bash bin/install-wp-tests.sh wordpress_test root '' localhost latestwhererootand''are your local mysql credentials. - Run
phpunitto see the tests in action!
Note: Be sure to have svn installed on your system. If anything fails running install-wp-tests.sh you'll have to delete /tmp/wordpress* and drop the wordpress_test database as well before running the command again.