You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-5Lines changed: 46 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# PHPUnit Skeleton #
2
-
_Get up and running with PHPUnit testing easily for your project_
2
+
_Get up and running with PHPUnit testing easily for your project with this skeleton_
3
3
4
4
* Are you frustrated with trying to install and configure PHPUnit?
5
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?
@@ -9,13 +9,15 @@ Well, I'm happy to let you know that you just need to `clone` this repo and all
9
9
10
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
11
12
-
# Simple-tastic 3 Step Installation #
12
+
##Simple-tastic 3 Step Installation##
13
13
* Open a Terminal. Download the repo with `git clone https://github.com/jasdeepkhalsa/tweet-counter.git`
14
14
*`cd` into where you downloaded your repo and run `php composer.phar self-update`
15
15
* Now, run `php composer.phar update`
16
16
17
+
Note: `php` refers to the location of your php executable, if its not on your system's path
18
+
17
19
## Run PHPUnit ##
18
-
* Open up a terminal
20
+
* Open a Terminal
19
21
*`cd` to your project root
20
22
* Type `./vendor/bin/phpunit` and...magic! Tests (should) now be running!
21
23
@@ -31,7 +33,46 @@ You should see something like...
31
33
32
34
OK (4 tests, 4 assertions)
33
35
34
-
# Credits #
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
+
63
+
3. Finally update the `namespace` inside the following php files:
64
+
* Inside `/lib/YourApp/Example.php` update `namespace Application;` to `namespace YourApp;`
65
+
* Inside `/tests/YourApp/ExampleTest.php` update `$this->obj = new Application\Example;` to `$this->obj = new YourApp\Example;`
66
+
67
+
4. Run `php composer.phar update` again to update the sources
68
+
69
+
5. Run `./vendor/bin/phpunit` again to make sure all tests are passing again
70
+
71
+
## Credits ##
35
72
* Me and my awesomely laborious efforts in getting to grips with PHPUnit testing
36
73
* Constant support from PHP Guru Jujhar Singh from [Buto](http://get.buto.tv/) who also inspired the test case style in the examples
37
-
* 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/)
74
+
* 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/)
75
+
76
+
## Contact ##
77
+
* Email: jasdeep {at} simplyspiritdesign {dot} com
0 commit comments