Okay, I develop web applications in PHP and JavaScript and a lot of times here on Stack Overflow I have seen the word unit test passing by, but nowhere on the websi
Unit tests are automated tests that test whether a given piece of code does what you expect it to do under a given set of circumstances. Good unit tests test small pieces of functionality, often at the level of individual functions.
Unit tests are usually structured such that you set up some state, run the function or method you want to test, and then assert either the output of that function, or a change in other state as a result of that function. Most unit testing frameworks have utilities for supporting and structuring this, such as:
Unit tests are useful for a number of reasons:
Unit tests are useful on any code that's larger than a few lines, regardless of language. I've definitely unit tested php code, even for relatively small projects, and have gotten immediate rewards from it.
In addition to what has already be answered, having tests cases covering your code allows you to proceed to Refactoring (improving your code design without modifying its observable behavior).
Unit test frameworks for PHP comprise PHPUnit and SimpleTest that have been compared on StackOverflow.
A google search for "php unit testing" yields a treasure trove of information on this subject. The PHPUnit project looks interesting.
Unit tests are for any code you wish to maintain.
In a nutshell, the idea is to write many small tests, each of which can be run in isolation, and test the smallest possible part of your codebase (often individual classes or individual functions). If I give this function the input it expects, does it return the output I expect? If it does, that means the rest of the application can pretty much assume it works. And if it doesn't, I'd rather catch the error in a small, simple, isolated unit test function than trying to trace it through the entirety of my application.
Of course, it also requires you to be fairly disciplined in how you write your code, both because it has to be possible to isolate individual functions or classes to test them, and because, well, the tests don't write themselves. You have to do that. ;)
Given the quality of most of the PHP code I've seen, I'd say unit testing definitely has its place in the PHP community. More so than in almost any other language, in fact. ;)
Most of the php I've seen is almost impossible to do unit testing on.
Wikipedia has an article on unit testing if you are interested.
If you write an application of any description, you should consider unit tests. Done properly, they force you to think about the quality of code you are delivering to your users. I think the issue you have here, is the difference between unit testing code and automated unit testing. Unit testing can be done as simply as writing down a set of tests and then manually running through them.
Automated unit testing, on the other hand, relies on you having some form of application/harness to run and rerun tests. With automated unit tests you can rerun tests just by pressing a button. So why is rerunning a test so important? Simply speaking, you don't write applications run tests on them once and then walk away from them. Write your tests so that you exercise your code in discrete little runs and run them throughout the development process. By doing this, with a well written set of tests, you stand a much better chance of identifying code that's been broken by upgrades.