Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdananton committed Dec 6, 2014
1 parent d1fe1cf commit f463692
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
PHPUnit file / folder structure generator. Works with [the CodeGraph app](https://github.com/bogdananton/PHP-CodeGraph)'s JSON output.

```
Usage: test-files-generator --source [PATH] --tests [PATH] --json [PATH/index_folders.json] --testnamespace [namespace prefix] (--todounit yes) (--classattributes yes)
Arguments:
--source The path to the PHP project's source folder.
--tests The path to the PHP project's tests folder.
--json PHP-CodeGraph index_folders.json file. Check out http://github.com/bogdananton/PHP-CodeGraph
--testnamespace (optional) Namespace prefix for test files. Default: "tests". Can be "tests\phpunit".
--todounit (optional) Set this flag to "yes" to enable scanning for @todounit markers in docblocks and appending them as test methods. Default: disabled.
--classattributes (optional) Set this flag to "yes" to generate basic tests that check that the class attributes exist. Default: disabled.
```

**Usage**

Generate the PHP-CodeGraph JSON file. Use the following command to generate the folders and files:
```
phpcg --source /projects/PHPUnit-TestFiles-Generator/demo/source/ --log /projects/PHPUnit-TestFiles-Generator/demo/
phpcg
--source /projects/PHPUnit-TestFiles-Generator/demo/source/
--log /projects/PHPUnit-TestFiles-Generator/demo/
```

Use the following command to scan for @todounit tags and generate/append the test methods (if not already generated):
```
test-files-generator --source /projects/PHPUnit-TestFiles-Generator/demo/source/ --tests /projects/PHPUnit-TestFiles-Generator/demo/tests/ --json /projects/PHPUnit-TestFiles-Generator/demo/index_folders.json --todounit yes --classattributes yes
test-files-generator
--source /projects/PHPUnit-TestFiles-Generator/demo/source/
--tests /projects/PHPUnit-TestFiles-Generator/demo/tests/
--json /projects/PHPUnit-TestFiles-Generator/demo/index_folders.json
--todounit yes
--classattributes yes
```

**Features**
Expand All @@ -24,4 +44,8 @@ test-files-generator --source /projects/PHPUnit-TestFiles-Generator/demo/source/
* All methods found in a class will be grouped in a folder having the same name as the class.
* The class' path will be mirrored for test files

If the class is `[PROJECT_PATH]/source/lib/Stock/Inventory.php` then the files will be added in the `[PROJECT_PATH]/tests/lib/Stock/Inventory/`. The source and tests paths can be overridden using the arguments when launching the application.-
If the class is `[PROJECT_PATH]/source/lib/Stock/Inventory.php` then the files will be added in the `[PROJECT_PATH]/tests/lib/Stock/Inventory/`. The source and tests paths can be overridden using the arguments when launching the application.

**Download**

Access the [releases page](https://github.com/bogdananton/PHPUnit-TestFiles-Generator/releases) and download the Windows or Linux binary. Start the application from the command line and follow the steps in the *Usage* section.

0 comments on commit f463692

Please sign in to comment.