Skip to content

Instantly share code, notes, and snippets.

@bablukpik
Last active February 22, 2017 20:04
Show Gist options
  • Save bablukpik/aaf1d205c2f3baca875463652f6601cb to your computer and use it in GitHub Desktop.
Save bablukpik/aaf1d205c2f3baca875463652f6601cb to your computer and use it in GitHub Desktop.
### What is PHPUnit?
-> PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
-> xUnit is the collective name for several unit testing frameworks that derive their structure and functionality.
### What is PHP Archive (PHAR)?
-> Phar archives are similar in concept to Java JAR archives. A Phar archive is used to distribute a complete PHP application or library in a single file. A Phar archive application is used exactly like any other PHP application:
i.e.
coollibrary.phar
Using a Phar archive library is identical to using any other PHP library:
<?php
include 'coollibrary.phar';
?>
N.B. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line.
->In PHPUnit
The easiest way to obtain PHPUnit is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file.
#### what is composer.json file?
To start using Composer in your project, all you need is a composer.json file. This file describes the dependencies of your project and may contain other metadata as well.
The require Key#
The first thing you specify in composer.json is the require key. You're simply telling Composer which packages your project depends on.
{
"require": {
"monolog/monolog": "1.0.*"
}
}
As you can see, require takes an object that maps package names (e.g. monolog/monolog) to version constraints (e.g. 1.0.*).
#### Installing Dependencies
To install the defined dependencies for your project, just run the install command.
php composer.phar install
### Installing PHPUnit:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment