{"id":1114,"date":"2015-09-22T08:30:00","date_gmt":"2015-09-22T13:30:00","guid":{"rendered":"https:\/\/2015.toronto.wordcamp.org\/?post_type=wcb_session&#038;p=1114"},"modified":"2015-09-24T09:42:39","modified_gmt":"2015-09-24T14:42:39","slug":"systematic-unit-testing","status":"publish","type":"wcb_session","link":"https:\/\/toronto.wordcamp.org\/2015\/session\/systematic-unit-testing\/","title":{"rendered":"Systematic Unit Testing"},"content":{"rendered":"<p>Unit testing is an important part of verifying that code works as expected. However, how many tests do you need to write before you can be confident that you&#8217;ve done a good job? Where should you be spending your time writing tests, and how do you know when you&#8217;re done?<!--more--><\/p>\n<p>In this talk, we discuss a systematic approach to unit testing WordPress plugins using phpunit. We show how to set up a simple test suite, to examine the code coverage options, and to identify the most risky areas of our code that are in need of tests.<\/p>\n<p><strong>Learning Outcomes<\/strong><\/p>\n<ul>\n<li>Build a scaffold for unit testing WordPress plugins<\/li>\n<li>Write meaningful unit tests for WordPress plugins using phpunit<\/li>\n<li>Use completeness coverage to show how well a test suite covers a plugin&#8217;s functionality<\/li>\n<li>Show how code coverage exposes potentially dangerous areas<\/li>\n<li>Encourage everyone to write unit tests, because they&#8217;re great and cool. \ud83d\ude42<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Unit testing is an important part of verifying that code works as expected. However, how many tests do you need to write before you can be confident that you&#8217;ve done a good job? Where should you be spending your time writing tests, and how do you know when you&#8217;re done?<\/p>\n","protected":false},"author":7821531,"featured_media":0,"template":"","meta":{"jetpack_post_was_ever_published":false,"_wcpt_session_time":1443974400,"_wcpt_session_duration":3000,"_wcpt_session_type":"session","_wcpt_session_slides":"","_wcpt_session_video":"","_wcpt_speaker_id":[853],"footnotes":""},"session_track":[8858],"session_category":[],"class_list":["post-1114","wcb_session","type-wcb_session","status-publish","hentry","wcb_track-developers"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5UjGY-hY","jetpack_likes_enabled":false,"session_date_time":{"date":"October 4, 2015","time":"11:00 am"},"session_speakers":[{"id":"853","slug":"scott-grant","name":"Scott Grant","link":"https:\/\/toronto.wordcamp.org\/2015\/speaker\/scott-grant\/"}],"session_cats_rendered":null,"_links":{"self":[{"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/sessions\/1114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/sessions"}],"about":[{"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/types\/wcb_session"}],"version-history":[{"count":2,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/sessions\/1114\/revisions"}],"predecessor-version":[{"id":1264,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/sessions\/1114\/revisions\/1264"}],"speakers":[{"embeddable":true,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/speakers\/853"}],"author":[{"embeddable":true,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wporg\/v1\/users\/sgrant"}],"wp:attachment":[{"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/media?parent=1114"}],"wp:term":[{"taxonomy":"wcb_track","embeddable":true,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/session_track?post=1114"},{"taxonomy":"wcb_session_category","embeddable":true,"href":"https:\/\/toronto.wordcamp.org\/2015\/wp-json\/wp\/v2\/session_category?post=1114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}