Skip to content

Commit 1516d6c

Browse files
author
Jasdeep Khalsa
committed
Updated readme.md
1 parent 22ea78d commit 1516d6c

1 file changed

Lines changed: 74 additions & 75 deletions

File tree

README.md

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,74 @@
1-
# PHPUnit Skeleton #
2-
_Get up and running with PHPUnit testing easily for your project with this skeleton_
3-
4-
* Are you frustrated with trying to install and configure PHPUnit?
5-
* Are you wishing you could use just one command and BANG it was all done for you and you could get on with writing your beautiful unit tests?
6-
* Are you having sleepless nights or sleepy afternoons?
7-
8-
Well, I'm happy to let you know that you just need to `clone` this repo and all your problems will be whisked away (apart from the last one, perhaps).
9-
10-
We have also included a sample PHP class so you can learn a few tricks in how to use PHPUnit in your projects!
11-
12-
## Simple-tastic 3 Step Installation ##
13-
* Open a Terminal. Download the repo with `git clone https://github.com/jasdeepkhalsa/tweet-counter.git`
14-
* `cd` into where you downloaded your repo and run `php composer.phar self-update`
15-
* Now, run `php composer.phar update`
16-
17-
Note: `php` refers to the location of your php executable, if its not on your system's path
18-
19-
## Run PHPUnit ##
20-
* Open a Terminal
21-
* `cd` to your project root
22-
* Type `./vendor/bin/phpunit` and...magic! Tests (should) now be running!
23-
24-
You should see something like...
25-
26-
PHPUnit 3.7.19 by Sebastian Bergmann.
27-
28-
Configuration read from /(directory)/phpunit-skeleton/phpunit.xml
29-
30-
....
31-
32-
Time: 0 seconds, Memory: 3.00Mb
33-
34-
OK (4 tests, 4 assertions)
35-
36-
## Customizing PHPUnit Skeleton ##
37-
Once you've successfully installed PHPUnit Skeleton, you'll probably want to customize it to your application.
38-
39-
### How do I change the name of the application? ###
40-
Once you have the name of your application which we shall refer to as `YourApp`, then do the following:
41-
42-
1. First you have to change the entry `Application` in the `composer.json` file to `YourApp`:
43-
44-
>
45-
> {
46-
> "require-dev": {
47-
> "phpunit/phpunit": "3.7.*",
48-
> "phpunit/dbunit": ">=1.2",
49-
> "phpunit/phpunit-selenium": ">=1.2"
50-
> },
51-
> "autoload": {
52-
> "psr-0": {
53-
> "`YourApp`": "lib/"
54-
> }
55-
> }
56-
> }
57-
>
58-
59-
2. Next, rename the following two directories from `Application` to `YourApp`:
60-
* Rename `/lib/Application/` to `/lib/YourApp/`
61-
* Rename `/tests/Application/` to `/tests/YourApp/`
62-
3. Finally update the `namespace` inside the following php files:
63-
* Inside `/lib/YourApp/Example.php` update `namespace Application;` to `namespace YourApp;`
64-
* Inside `/tests/YourApp/ExampleTest.php` update `$this->obj = new Application\Example;` to `$this->obj = new YourApp\Example;`
65-
4. Run `php composer.phar update` again to update the sources
66-
5. Run `./vendor/bin/phpunit` again to make sure all tests are passing again
67-
68-
## Credits ##
69-
* Me and my awesomely laborious efforts in getting to grips with PHPUnit testing
70-
* Constant support from PHP Guru Jujhar Singh from [Buto](http://get.buto.tv/) who also inspired the test case style in the examples
71-
* Class examples inspired from video by Jeffrey Way from [Nettuts+](http://net.tutsplus.com/tutorials/php/better-workflow-in-php-with-composer-namespacing-and-phpunit/)
72-
73-
## Contact ##
74-
* Email: jasdeep {at} simplyspiritdesign {dot} com
75-
* Twitter: [@JasdeepKhalsa1](http://twitter.com/@JasdeepKhalsa1)
1+
# PHPUnit Skeleton #
2+
_Get up and running with PHPUnit testing easily for your project with this skeleton_
3+
4+
* Are you frustrated with trying to install and configure PHPUnit?
5+
* Are you wishing you could use just one command and BANG it was all done for you and you could get on with writing your beautiful unit tests?
6+
* Are you having sleepless nights or sleepy afternoons?
7+
8+
Well, I'm happy to let you know that you just need to `clone` this repo and all your problems will be whisked away (apart from the last one, perhaps).
9+
10+
We have also included a sample PHP class so you can learn a few tricks in how to use PHPUnit in your projects!
11+
12+
## Simple-tastic 3 Step Installation ##
13+
* Open a Terminal. Download the repo with `git clone https://github.com/jasdeepkhalsa/tweet-counter.git`
14+
* `cd` into where you downloaded your repo and run `php composer.phar self-update`
15+
* Now, run `php composer.phar update`
16+
17+
Note: `php` refers to the location of your php executable, if its not on your system's path
18+
19+
## Run PHPUnit ##
20+
* Open a Terminal
21+
* `cd` to your project root
22+
* Type `./vendor/bin/phpunit` and...magic! Tests (should) now be running!
23+
24+
You should see something like...
25+
26+
PHPUnit 3.7.19 by Sebastian Bergmann.
27+
28+
Configuration read from /(directory)/phpunit-skeleton/phpunit.xml
29+
30+
....
31+
32+
Time: 0 seconds, Memory: 3.00Mb
33+
34+
OK (4 tests, 4 assertions)
35+
36+
## Customizing PHPUnit Skeleton ##
37+
Once you've successfully installed PHPUnit Skeleton, you'll probably want to customize it to your application.
38+
39+
### How do I change the name of the application? ###
40+
Once you have the name of your application which we shall refer to as `YourApp`, then do the following:
41+
42+
1. First you have to change the entry `Application` in the `composer.json` file to `YourApp`:
43+
44+
> {
45+
> "require-dev": {
46+
> "phpunit/phpunit": "3.7.*",
47+
> "phpunit/dbunit": ">=1.2",
48+
> "phpunit/phpunit-selenium": ">=1.2"
49+
> },
50+
> "autoload": {
51+
> "psr-0": {
52+
> "`YourApp`": "lib/"
53+
> }
54+
> }
55+
> }
56+
>
57+
58+
2. Next, rename the following two directories from `Application` to `YourApp`:
59+
* Rename `/lib/Application/` to `/lib/YourApp/`
60+
* Rename `/tests/Application/` to `/tests/YourApp/`
61+
3. Finally update the `namespace` inside the following php files:
62+
* Inside `/lib/YourApp/Example.php` update `namespace Application;` to `namespace YourApp;`
63+
* Inside `/tests/YourApp/ExampleTest.php` update `$this->obj = new Application\Example;` to `$this->obj = new YourApp\Example;`
64+
4. Run `php composer.phar update` again to update the sources
65+
5. Run `./vendor/bin/phpunit` again to make sure all tests are passing again
66+
67+
## Credits ##
68+
* Me and my awesomely laborious efforts in getting to grips with PHPUnit testing
69+
* Constant support from PHP Guru Jujhar Singh from [Buto](http://get.buto.tv/) who also inspired the test case style in the examples
70+
* Class examples inspired from video by Jeffrey Way from [Nettuts+](http://net.tutsplus.com/tutorials/php/better-workflow-in-php-with-composer-namespacing-and-phpunit/)
71+
72+
## Contact ##
73+
* Email: jasdeep {at} simplyspiritdesign {dot} com
74+
* Twitter: [@JasdeepKhalsa1](http://twitter.com/@JasdeepKhalsa1)

0 commit comments

Comments
 (0)