Settle in and apm install wordpress-develop
broadway/www/wordpress-develop/
must exist
apm install wordpress-develop
TDD: Write your (failing) tests first, then make them pass.
It all starts with the tests!
Let's go to our Fieldmanager directory and run them:
cd ~/broadway/plugins/wordpress-fieldmanager/
phpunit
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 4.2.6 by Sebastian Bergmann.
Configuration read from /var/www/wordpress/wp-content/plugins/wordpress-fieldmanager/phpunit.xml
............................................................... 63 / 158 ( 39%)
............................................................... 126 / 158 ( 79%)
................................
Time: 13.83 seconds, Memory: 33.00Mb
OK (158 tests, 1690 assertions)
phpunit --group=quickedit
F.....
Time: 2.11 seconds, Memory: 26.75Mb
There was 1 failure:
1) Test_Fieldmanager_Context_Quickedit::test_context_render
Failed asserting that '' contains "fm-quickedit".
/var/www/wordpress/wp-content/plugins/wordpress-fieldmanager/tests/php/test-fieldmanager-context-quickedit.php:128
FAILURES!
Tests: 6, Assertions: 40, Failures: 1.
PHPUnit is a unit testing framework. You use it to test small, individual units of functionality
Don't be intimidated! Writing unit tests is simple and fun
For FM, there's the PHPUnit framework, but there's also an extension provided by WordPress Core
Code Coverage: a helpful report card
xdebug_on
phpunit --coverage-html ./report
What does a test look like?
function test_truthiness() {
$this->assertTrue( true );
}
What about JS?
Someone, please, set that up
Five options