vim-phpunit


Ⅰ. 插件描述

Generate PHPUnit test cases with composer and reflaction

Ⅱ. 基本信息

创建日期:  2015-05-09
使用用户:  7
Github星:  0
插件作者:  dantleech

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'dantleech/vim-phpunit-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'dantleech/vim-phpunit-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'dantleech/vim-phpunit-better-than-revenge'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/dantleech/vim-phpunit

Ⅳ. 文档说明

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:

{
    "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:

Plugin 'dantleech/vim-phpunit'

Configuration

By default it will prefix the sub-namespace with Tests, this can be
overridden as follows:

let g:phpunit_namespace_prefix="Tests\\Unit"

You can also chane the path to phpunit:

let g:phpunitpath="/usr/local/bin/phpunit"

Mapping:

nnoremap <silent><leader>pt :call PhpunitGenerate()<CR>
nnoremap <silent><leader>pp :call PhpunitRun()<CR>

Notes

  • Currently only works with psr-4

添加新评论