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
This skeleton ships with [PHP-CS-Fixer](https://cs.symfony.com/) configured for the PSR-12 coding standard.
43
+
44
+
* Check for violations: `composer cs-check`
45
+
* Automatically fix violations: `composer cs-fix`
46
+
47
+
## Customizing PHPUnit Skeleton ##
37
48
Once you've successfully installed PHPUnit Skeleton, you'll probably want to customize it to your application.
38
49
39
50
### How do I change the name of the application? ###
40
51
Once you have the name of your application which we shall refer to as `YourApp`, then do the following:
41
52
42
-
1. First you have to change the entry `Application` in the `composer.json` file to `YourApp` under the object `psr-0`:
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
53
+
1. First you have to change the entry `Application` in the `composer.json` file to `YourApp` under `autoload.psr-4` (and `autoload-dev.psr-4` if you keep the same pattern for tests):
54
+
55
+
```json
56
+
{
57
+
"autoload": {
58
+
"psr-4": {
59
+
"YourApp\\": "lib/"
60
+
}
61
+
},
62
+
"autoload-dev": {
63
+
"psr-4": {
64
+
"Tests\\": "tests/"
65
+
}
66
+
}
67
+
}
68
+
```
69
+
70
+
2. Update the `namespace` inside the following PHP files:
71
+
* Inside `/lib/Example.php` update `namespace Application;` to `namespace YourApp;`
72
+
* Inside `/tests/ExampleTest.php` update `use Application\Example;` to `use YourApp\Example;`
73
+
3. Run `composer dump-autoload` to refresh the autoloader
74
+
4. Run `composer test` again to make sure all tests are passing again
66
75
67
76
## Credits ##
68
77
* To the wonderful people on [Stack Overflow](http://stackoverflow.com/questions/15710410/autoloading-classes-in-phpunit-using-composer-and-autoload-php) for helping me understand PHPUnit better
0 commit comments