{"id":592,"date":"2007-08-18T19:11:40","date_gmt":"2007-08-18T23:11:40","guid":{"rendered":"http:\/\/www.wehuberconsultingllc.com\/wordpress\/?p=592"},"modified":"2007-08-19T07:27:09","modified_gmt":"2007-08-19T11:27:09","slug":"updating-phpunit-on-xampp","status":"publish","type":"post","link":"https:\/\/wehuberconsultingllc.com\/wordpress\/2007\/08\/18\/updating-phpunit-on-xampp\/","title":{"rendered":"Updating PHPUnit on XAMPP"},"content":{"rendered":"<p>I have decided to do some playing around with unit tests for PHP. I saw a video on <a href=\"http:\/\/onemansblog.com\/2007\/08\/17\/wordcamp-2007-getting-involved-with-wordpress\/\">Getting Involved in WordPress<\/a> and it reminded me of my interest in unit testing. Now I almost want to create some unit tests for verifying WordPress plugins or phpWebSite code. Fortunately, common sense will prevail and I will restrict my activities to playing. The instructions at <a href=\"http:\/\/www.phpunit.de\/pocket_guide\/3.2\/en\/installation.html\">Chapter 3. Installing PHPUnit<\/a> looked pretty easy but since I wanted to do my testing under XAMPP I knew there would be problems. Hopefully the problems would be minor.<\/p>\n<h3>Confirm the PEAR configuration<\/h3>\n<p>The first thing I did was to open a command window in the PHP directory under xampp and ran the following command.<\/p>\n<p><code><strong>pear show-config<\/strong><\/code><\/p>\n<p>This command prompting elicited an error about improperly set environment variables. So I edited the file and inserted the full path to the XAMPP directory. I tried the command again and it showed the PEAR configuration. I checked the installed packages and it showed PHPUnit to be version 1.3.2. I would like to use the latest version so I am going to follow the instructions from the <a href=\"http:\/\/www.phpunit.de\/pocket_guide\/3.2\/en\/index.html\">documentation<\/a>.<\/p>\n<h3>Update the channel and install the PHPUnit<\/h3>\n<p>The next commands I tried were to update the channel and install PHPUnit.<\/p>\n<p><strong><code>pear channel-discover pear.phpunit.de<\/code><\/strong><br \/>\n<br \/><strong><code>pear install phpunit\/PHPUnit<\/code><\/strong><\/p>\n<p>The channel command worked. The install command did not work since it wanted the a dependency updated, GraphViz. After updating the dependency I ran the install command again. It installed 3.1.7&nbsp;and it said I could also install pdo_sqlite and xdebug. I tried to install these extensions but they ended with a DSP error.<\/p>\n<h3>Test the PHPUnit<\/h3>\n<p>To test the installation I created a new folder under htdocs called phpunit so that I would have all of the unit test files in one spot. I quickly found out that I needed a copy of the phpunit.bat file in that directory, too. This file is in the PHP folder and it has the correct path to the php.exe file. I copied the example ArrayTest from the documentation into a file called ArrayTest.php and ran the command, &#8220;<strong><code>phpunit ArrayTest<\/code><\/strong>&#8220;. It worked. Now I can move on to more sophisticated unit tests.<\/p>\n<h3>Final Fixups<\/h3>\n<p>After a little searching I found that the xdebug and pdo_sqlite extenstions already exist in the extensions folder. XAMPP installs all of the extensions but only enables a couple of them in the default installation.&nbsp;All I had to do was to edit the php.ini file,&nbsp;remove the semi-colon in front of these extensions, and restart the web server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have decided to do some playing around with unit tests for PHP. I saw a video on Getting Involved in WordPress and it reminded me of my interest in unit testing. Now I almost want to create some unit tests for verifying WordPress plugins or phpWebSite code. Fortunately, common sense will prevail and I &hellip; <a href=\"https:\/\/wehuberconsultingllc.com\/wordpress\/2007\/08\/18\/updating-phpunit-on-xampp\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Updating PHPUnit on XAMPP&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,8,3],"tags":[128,16,123],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-css","category-phpwebsite","category-wordpress","tag-phpwebsite","tag-webdesign","tag-wordpress"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4iN3d-9y","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":0,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"wp:attachment":[{"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wehuberconsultingllc.com\/wordpress\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}