Merge pull request #737 from codeinabox/phpunit-test-methods

PHPUnit snippets for setup, tear down and marking tests skipped
This commit is contained in:
Louis Pilfold 2016-05-22 14:47:59 +01:00
commit 5aed7e10cb

View File

@ -1,8 +1,11 @@
# suggestion? report bugs? # suggestion? report bugs?
# please go to https://github.com/chrisyue/vim-snippets/issues # please go to https://github.com/chrisyue/vim-snippets/issues
#
# to use add the following to your .vimrc
# `autocmd BufRead,BufNewFile,BufEnter *Test.php UltiSnipsAddFiletypes php-phpunit`
priority -50 priority -50
snippet test "phpunit test class" b snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
<?php <?php
namespace `!p namespace `!p
@ -21,11 +24,32 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
{ {
public function test${1}() public function test${1}()
{ {
${2} ${0:${VISUAL}}
} }
} }
endsnippet endsnippet
snippet test "public function testXYZ() { ... }"
public function test${1}()
{
${0:${VISUAL}}
}
endsnippet
snippet setup "protected function setUp() { ... }"
protected function setUp()
{
${0:${VISUAL}}
}
endsnippet
snippet teardown "protected function tearDown() { ... }"
protected function tearDown()
{
${0:${VISUAL}}
}
endsnippet
snippet exp "phpunit expects" i snippet exp "phpunit expects" i
expects($this->${1:once}()) expects($this->${1:once}())
->method('${2}') ->method('${2}')
@ -38,3 +62,15 @@ snippet testcmt "phpunit comment with group" b
* @group ${1} * @group ${1}
*/ */
endsnippet endsnippet
snippet fail "$this->fail()"
$this->fail(${1});
endsnippet
snippet marki "$this->markTestIncomplete()"
$this->markTestIncomplete(${1});
endsnippet
snippet marks "$this->markTestSkipped()"
$this->markTestSkipped(${1});
endsnippet