https://github.com/dantleech/vim-phpunit
Generate PHPUnit test cases with composer and reflaction
https://github.com/dantleech/vim-phpunit
Last synced: over 1 year ago
JSON representation
Generate PHPUnit test cases with composer and reflaction
- Host: GitHub
- URL: https://github.com/dantleech/vim-phpunit
- Owner: dantleech
- Created: 2015-05-09T07:36:52.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-11-26T13:17:20.000Z (over 10 years ago)
- Last Synced: 2025-01-30T15:44:23.282Z (over 1 year ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
vim-phpunit
===========
Generates and opens an empty (or the existing) PHPUnit test case for the
current class using Reflection and `composer.json`.
For example, if your file's namespace is `namespace MyProject\Bar\Doo` and
composer autoload is configured with `{"MyProject\\": "foo/"}` then the test
namespace will be `namespace MyProject\Tests\Bar\Doo` and the test will
created at `foo/Tests/Bar/DooTest.php`
If you have defined a specific location for tests in your `composer.json` then
that path will be used, for example:
````php
{
"autoload": {
"psr-4": {
"MyProject\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MyProject\\Tests\\": "tests/"
}
}
}
````
The generated test namespace will match the `autoload-dev` entry, and the test
will be created at `tests/Bar/DooTest.php`.
Installation
------------
Using vundle:
````vim
Plugin 'dantleech/vim-phpunit'
````
Configuration
-------------
By default it will prefix the sub-namespace with `Tests`, this can be
overridden as follows:
````vim
let g:phpunit_namespace_prefix="Tests\\Unit"
````
You can also chane the path to phpunit:
````vim
let g:phpunitpath="/usr/local/bin/phpunit"
````
Mapping:
````vim
nnoremap pt :call PhpunitGenerate()
nnoremap pp :call PhpunitRun()
````
Notes
-----
- Currently only works with `psr-4`