2017 © Pedro Peláez
 

study phpunit_tutorial

Simple project using PHPUnit.

image

zvoanhkietz/phpunit_tutorial

Simple project using PHPUnit.

  • Saturday, March 25, 2017
  • by zvoanhkietz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

PHPUnit Tutorial - Calculator

Software License Build Status Coverage Status Latest Stable Version, (*1)

NetBeans PHP Sample Application

What is Calculator?

Calculator is a simple calculator that supports basic arithmetical operations. This PHP application is created to highlight PHP features supported by NetBeans IDE., (*2)

This sample is not intented to be used in a production environment without any changes., (*3)

This sample demonstrates the following features:

  • unit testing using PHPUnit
  • creating unit tests using PHPUnit Skeleton Generator
  • code coverage of project files

Requirements

Follow these before you run the sample:, (*4)

  • Install NetBeans IDE with PHP support
  • Install and configure PHP Runtime
  • Install all dependencies using Composer (click on project and invoke Composer > Install (dev))
    Note: PHPUnit can also be installed globally as PHAR file
  • Install and configure PHPUnit Skeleton Generator
  • For debugging and code coverage, Xdebug PHP extension is required

What is included?

  • NetBeans PHP Application Project

Before the start

  • If you want to try the sample out, follow Getting Started guidelines.
  • In case if you want to try debugging features of the NetBeans IDE, follow the Debugging guidelines.

Getting Started

  1. For the very first run, PHPUnit must be installed via Composer and PHPUnit Skeleton Generator globally (see Requirements).
  2. Now, create a unit test for Calculator class - open it in the editor and select Tools > Create Tests.
  3. Simply test the project. Right-click the project node and select Test. IDE will inform you about the test results (window with test results can be opened manually).
  4. For code coverage, open its report (right-click the project node and select Code Coverage > Show Report...) and Run All Tests if there are no data available yet. Open Calculator.php file from the list of the files to see which lines are and which lines are not tested.
  5. Play futher with the sample :)

Debugging

These steps should enable you the debugging option at the sample project, if you already have PHP debugger (Xdebug) installed and configured.
For demonstrating the PHP debugger in NetBeans, try the following:, (*5)

  1. Open source class Calculator.php or generated CalculatorTest.php in the editor.
  2. Put breakpoint on some line with PHP code.
  3. To debug, right-click CalculatorTest.php and select Debug.

NetBeans PHP team, 2013 © Copyright Oracle corp., All rights reserved, (*6)

The Versions

25/03 2017

dev-master

9999999-dev

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

27/09 2016

dev-jenkins

dev-jenkins

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

01/08 2016

dev-test_private_protected

dev-test_private_protected

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

31/07 2016

1.0.1.x-dev

1.0.1.9999999-dev

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

31/07 2016

v1.0.1

1.0.1.0

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

31/07 2016

v1.0.2

1.0.2.0

Simple project using PHPUnit.

  Sources   Download

GPL

The Development Requires

by Vo Anh Kiet

31/07 2016

dev-update_save_user

dev-update_save_user

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by NetBeans

30/07 2016

1.0.0.x-dev

1.0.0.9999999-dev

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by Vo Anh Kiet

30/07 2016

v1.0.0

1.0.0.0

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by Vo Anh Kiet

30/07 2016

dev-add_method_json_encode

dev-add_method_json_encode

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by NetBeans

30/07 2016

dev-code_coverage_ignore

dev-code_coverage_ignore

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by NetBeans

30/07 2016

dev-system_add_random

dev-system_add_random

Simple project using PHPUnit.

  Sources   Download

The Development Requires

by NetBeans