How Testing Changed My Life
- 11. class WP_Is_Email_Test extends WP_UnitTestCase {
function test_is_email_only_letters_with_dot_com_domain() {
$this-‐>assertEquals( 'nb@nikolay.com', is_email( 'nb@nikolay.com' ) );
}
function test_is_email_should_not_allow_missing_tld() {
$this-‐>assertFalse( is_email( 'nb@nikolay' ) );
}
function test_is_email_should_allow_bg_domain() {
$this-‐>assertEquals( 'nb@nikolay.bg', is_email( 'nb@nikolay.bg' ) );
}
}
0. what?
- 12. class WP_Is_Email_Test extends WP_UnitTestCase {
function test_is_email_only_letters_with_dot_com_domain() {
$this-‐>assertEquals( 'nb@nikolay.com', is_email( 'nb@nikolay.com' ) );
}
function test_is_email_should_not_allow_missing_tld() {
$this-‐>assertFalse( is_email( 'nb@nikolay' ) );
}
function test_is_email_should_allow_bg_domain() {
$this-‐>assertEquals( 'nb@nikolay.bg', is_email( 'nb@nikolay.bg' ) );
}
}
0. what?
- 16. Grab the
Framework
https://github.com/nb/wordpress-tests
soon in core
2. do it yourself!
- 17. Please, read
http://xunitpatterns.com/
at least Narratives:
http://xunitpatterns.com/Book
%20Outline.html
2. do it yourself!
- 19. PHPUnit in your
editor
https://github.com/meritt/phpunit-tmbundle/
https://github.com/klokane/vim-phpunit
2. do it yourself!