{"id":539,"date":"2008-09-20T11:35:30","date_gmt":"2008-09-20T15:35:30","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=539"},"modified":"2011-12-17T12:27:35","modified_gmt":"2011-12-17T16:27:35","slug":"chuck-has-learned-a-little-bit-in-the-past-five-years","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2008\/09\/chuck-has-learned-a-little-bit-in-the-past-five-years\/","title":{"rendered":"Chuck *has* learned a little bit in the past five years"},"content":{"rendered":"<p>\nI am pretty happy with myself &#8211; in the past five years &#8211; I have learned the importance of unit testing.  Here I am hacking at my NG LMS based on IMS Learning Tool Interoperability &#8211; and instead of just writing a ton of code, I first spend two hours and wrote a PHP unit test framework so I could unit test all of my PHP utility code.  It is pretty cool &#8211; it makes it so you don&#8217;t have to keep pressing REFRESH when you write code and also when you write debug code to exercise code &#8211; you just keep it in a unit test as well.  I also wrote a PHP logging\/debugging mechanism &#8211; so I don&#8217;t have to keep printing out stuff and then commenting out the prints &#8211; the logging automatically gets verbose during unit tests.<\/p>\n<p>\nPart of this is that I miss Rails &#8211; I liked the fact that you could write less mainstream code and fall back on Rails conventions for stuff.  Now you might ask &#8211; which not use a Rails clone like Ignitor or a bunch of others &#8211; the problem with those is that they are too big.  I want something that gives me functionality with a single require_once() in my code &#8211; and that the distribution is a single or a few PHP scripts and not a BUNCH of hacking on my PHP installation.    I want it clean and simple and a natural extension to basic PHP work patterns.<\/p>\n<p>\nSo I have progressed to understanding the importance of Unit tests but have not yet gotten to the point where I am willing to pull in a terabyte of some other framework.  Ah well.<\/p>\n<p>\nHere is sample output:<\/p>\n<pre>\n======Running Unit Tests for ALL-Tests\n===Running Unit Test:ALL-Tests function:unittest_debug_01\nLine 1\nLine 2 &lt;tag>\n=============\nLine 1\nLine 2 &lt;tag>\n=============\nLine 1<br>\nLine 2 &lt;tag>\n===Running Unit Test:ALL-Tests function:unittest_debug_02\nLine 1\nLine 2 &lt;tag>\n===Running Unit Test:ALL-Tests function:unittest_nonce_01\n2008-09-20T15:22:27Z\n9423067 3600\nExpired\n===Running Unit Test:ALL-Tests function:unittest_nonce_02\nPresha1 5a10e285-6a52-4dc6-816b-d917c28302692008-06-03T13:51:20Zsecret\npostsha1 zhA0wHlwZaavrEIUw0wNPlTR3PQ=\ndigest zhA0wHlwZaavrEIUw0wNPlTR3PQ=\nMatch\n===Running Unit Test:ALL-Tests function:unittest_nonce_03\nPresha1 5a10e285-6a52-4dc6-816b-d917c28302692008-06-03T13:51:20Zsecret\npostsha1 zhA0wHlwZaavrEIUw0wNPlTR3PQ=\ndigest zhA0wHlwZaavrEIUw0wNPlTR3PQ=\nMatch\n======Completed unit tests for ALL-Tests\nResult: PPPPP\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am pretty happy with myself &#8211; in the past five years &#8211; I have learned the importance of unit testing. Here I am hacking at my NG LMS based on IMS Learning Tool Interoperability &#8211; and instead of just writing a ton of code, I first spend two hours and wrote a PHP unit [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-539","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=539"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/539\/revisions"}],"predecessor-version":[{"id":2654,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/539\/revisions\/2654"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}