SimpleTest

.code { border-width: thin; border-style: dotted; border-color: red; size: 12pt; background: black; color: lime; } .output { border-width: thin; border-style: solid; border-color: red; size: 12pt; background: black; color: cyan; } div.indent { margin-left: 1.5em; width: 100%; } A while back I was working on a site, and as I was writing the back end and making sure that it works properly I thought to myself "If .NET has nunit, and Java has junit, does PHP have phpunit, or something similar?" After some digging I found the answer. The answer I found was yes! In addition to finding unit frame works for PHP I also found some for other languages like ada, haskell and so on:aunit - for Ada hunit - for Haskell ant-junit - Apache Ant's optional tasks depending on junit dbunit - DBUnit is a JUnit extension targeted for database-driven pr ojects. tagunit - for testing custom JSP tags xmlunit - for XML and so on. If you want a complete list, on the command prompt, if you're using Gentoo, just type:

Continue Reading

Eclipse, PHP, and XDebug

.code { border-width: thin; border-style: dotted; border-color: red; size: 12pt; background: black; color: lime; } .output { border-width: thin; border-style: solid; border-color: red; size: 12pt; background: black; color: cyan; } div.indent { margin-left: 1.5em; width: 100%; } In the past I've written how to use Eclipse with phpdbg and ZendDebugger. The phpdbg was short lived as it was replaced with xdebug. According to Zend's website, they say that there are no serious limitations of xdebug. However, there may be some limitations when working with other Zend modules. This is not going to be a problem seeing as all I want to do use it to debug web pages. This will work on either Windows, Linux, and possibly MacOS X. Since posting about Eclipse and Zend, it has gotten much easier to get Eclipse and configure it for PHP. Go to Eclipse's homepage. On the front page there is a link to download the IDE for other languages; click on that and get the one for PHP.

Continue Reading

Java Doc

Documentation is key when programming. There is the documentation in the code itself such as what the heck you're trying to do there. There is also the documentation that describes the functions and objects and how to use them. Luckily there is a tool that helps the programmer create nice HTML documentation based on the comments within the code. This knocks out two birds with one stone. Javadoc is the tool to use for this task. There is also PHPdoc as well for, you guessed it PHP. For this entry we'll only be concerned about Javadoc.

Continue Reading

Unit Testing PHP

PHP Unit Testing .code { border-width: thin; border-style: dotted; border-color: red; size: 12pt; background: black; color: lime; } .output { border-width: thin; border-style: solid; border-color: red; size: 12pt; background: black; color: cyan; } div.indent { margin-left: 1.5em; width: 100%; }

A while back I was working on a site, and as I was writing the back end and making sure that it works properly I thought to myself "If .NET has nunit, and Java has junit, does PHP have phpunit, or something similar?" After some digging I found the answer. The answer I found was yes! In addition to finding unit frame works for PHP I also found some for other languages like ada, haskell and so on: aunit - for Ada hunit - for Haskell ant-junit - Apache Ant's optional tasks depending on junit dbunit - DBUnit is a JUnit extension targeted for database-driven pr ojects. tagunit - for testing custom JSP tags xmlunit - for XML and so on. If you want a complete list, on the command prompt, if you're using Gentoo, just type:

# emerge --search unit | less

and have fun! For PHP there are a few different ones: dev-php4/phpunit dev-php5/phpunit dev-php/simpletest At the time of writing this, dev-php4/phpunit is masked, but the version of phpunit for PHP 5 is not. I chose simpletest because I didn't have to unmask any packages in order to install it.

# emerge simpletest

BAM! Done!

Continue Reading

PHP, Zend Debugger, Eclipse

.code { border-width: thin; border-style: dotted; border-color: red; size: 12pt; background: black; color: lime; } .output { border-width: thin; border-style: solid; border-color: red; size: 12pt; background: black; color: cyan; } div.indent { margin-left: 1.5em; width: 100%; } A while ago I wrote how you can configure Eclipse, PHP on a Linux machine to debug PHP pages using phpdbg. At first this worked very well but after a while break point wouldn't work and I would have to restart the session. Another problem that I was having was that the session information was saved. I got around this by clearing out the session information in Firefox. This continued until one day when I tried to start a new debug session and all I got was this: At that point I decided to dump phpdbg and start using the Zend Debugger. Getting the extension to work properly took some time. After many hours of searching the Internet I managed to find a decent site to work off of. Unfortunately, it was aimed at the Windows platform. Getting PHP and eclipse configured was half the battle that I faced.

Continue Reading

Debugging With Eclipse and PHPdbg in Linux

p.code { background: black; color: lime; } tr { background: black; color: lime; } table { border-width: thin; border-color: #00FF00; size: 12pt; width: 100% } div.indent { margin-left: 1.5em; width: 100%; } Using a debugger to help find errors will save you a consider amount of time. Eclipse is a great IDE because not only is it platform independent, but you can use it to program in many different languages. The features and plugins seem endless which is an added bonus. The main reason why I like it is that it works on Linux. ;)

Continue Reading
Close Menu