O'Reilly logo

PHP Application Development with NetBeans Beginner's Guide by M A Hossain Tonu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — using code coverage

Follow the steps below to see how the code coverage feature works in NetBeans:

  1. Open Calculator.php, add a duplicate add function, and name it add2. The Calculator class now looks similar to the following:
    <?php
    class Calculator {
    /**
    * @assert (0, 0) == 0
    * @assert (0, 1) == 1
    * @assert (1, 0) == 1
    * @assert (1, 1) == 2
    * @assert (1, 2) == 4
    */
    public function add($a, $b) {
    return $a + $b;
    }
    public function add2($a, $b) {
    return $a + $b;
    }
    }
    ?>
    
  2. Right-click on the project node. From the Context menu, select Code Coverage | Collect and Display Code Coverage. By default, the Show Editor Bar is also selected.
    Time for action — using code coverage
  3. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required