concept web test in category php

This is an excerpt from Manning's book PHP in Action: Objects, Design, Agility.
If you know exactly what part of the web interface the conditional statement affects, it may be possible to get by with web tests only (see the next chapter). If the web interface is not going to change, these tests will stay useful.
To keep our application as safe from bugs as possible, we need a containment building or a safety net: integration and acceptance tests to ensure that the units work properly together and that the application as a whole is performing as intended. In the context of web programming, these tests are typically web tests. Even though unit tests are supposed to cover every behavior and prevent all possible bugs, in practice they don’t. And, especially when we use mock objects, there are sometimes leaks between the tests, causing integration bugs. Web tests will catch most—hopefully the vast majority—of these remaining defects.
Moving the code into its own class, and then its own file, are two trivial steps that can be done under the control of our web test. Once we add more validation and other more-complex behavior into the mix, using web tests becomes clumsy. Then it’s best to write unit tests for our controllers.
Partly this is because web tests are slow. Even when testing through the localhost interface, a large test case can take several seconds to run. The sheer complexity of some pages can make them take longer than that. I’ve seen full site tests that take 20 minutes or more to run. This was why we placed the web tests into a separate test runner script early on; we wanted to keep the unit tests separate and fast. By moving as much controller code as possible out of the top-level scripts and into unit tests, we get back our fast feedback cycle.
The bigger problem with web testing is that when something fails, it can be difficult to isolate. Suppose a database query produces an error deep in the code. At the web page level, all we would get would be some bland message such as “server error, please retry.” Hardly much help when we are debugging. Unit tests test individual components and classes. When that component fails, the unit test makes it clear where the problem is. Only that unit test will fail, as long as the other tests use a mocked database. By contrast, a database failure could break every single web test. Hardly much help tracking down the problem. Web tests make a great safety net, but make a poor diagnostic tool.