Giter VIP home page Giter VIP logo

phpunit-demo's Introduction

PHPUnit Demo

This is a demonstration of how to use PHPUnit.

This demo has PHPUnit installed using Composer. For a system-wide installation, you may choose to install PHPUnit using PEAR instead. Run the following command to install PHPUnit (and any other dependencies):

$ ./composer.phar install --dev

The demo unit tests can be found in the tests/FoundLineTest/PHPUnitDemo directory. The demo source code being tested can be found in the src/FoundLine/PHPUnitDemo directory. The subdirectory names within the tests and src directories follow the PSR-0 standard. For the unit tests, the vendor name FoundLineTest and the namespace PHPUnitDemo are used. For the source code being tested, the vendor name FoundLine and the namespace PHPUnitDemo are used. Following the PSR-0 standard allows for the autoloading of classes.

The following command will run all of the unit tests in this demo:

$ ./vendor/bin/phpunit tests

The previous command should result in output similar to the following:

PHPUnit 3.7.21 by Sebastian Bergmann.

.....

Time: 0 seconds, Memory: 4.75Mb

OK (5 tests, 5 assertions)

A useful option is to report test execution progress in TestDox format:

$ ./vendor/bin/phpunit --testdox tests

The previous command should result in output similar to the following:

PHPUnit 3.7.21 by Sebastian Bergmann.

FoundLineTest\PHPUnitDemo\Number
 [x] Convert number to string
 [x] Add two numbers
 [x] Substract two numbers
 [x] Multiply two numbers
 [x] Divide two numbers

phpunit-demo's People

Contributors

bradley-holt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.