2014-02-26 03:31:33 -05:00
|
|
|
# suggestion? report bugs?
|
2013-08-26 09:11:23 -04:00
|
|
|
# please go to https://github.com/chrisyue/vim-snippets/issues
|
2016-05-02 08:55:36 -04:00
|
|
|
#
|
|
|
|
# to use add the following to your .vimrc
|
|
|
|
# `autocmd BufRead,BufNewFile,BufEnter *Test.php UltiSnipsAddFiletypes php-phpunit`
|
2014-02-26 03:31:33 -05:00
|
|
|
priority -50
|
|
|
|
|
2016-05-02 08:55:36 -04:00
|
|
|
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
|
2016-04-30 06:28:18 -04:00
|
|
|
<?php
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
namespace `!p
|
2016-04-30 06:28:18 -04:00
|
|
|
relpath = os.path.relpath(path)
|
|
|
|
m = re.search(r'[A-Z].+(?=/)', relpath)
|
2013-08-26 09:11:23 -04:00
|
|
|
if m:
|
|
|
|
snip.rv = m.group().replace('/', '\\')
|
|
|
|
`;
|
|
|
|
|
|
|
|
/**
|
2016-04-30 06:28:18 -04:00
|
|
|
* @author `!v g:snips_author`
|
2013-08-26 09:11:23 -04:00
|
|
|
*/
|
|
|
|
class `!p
|
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
|
|
|
` extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
public function test${1}()
|
|
|
|
{
|
2016-05-02 08:55:36 -04:00
|
|
|
${0:${VISUAL}}
|
2013-08-26 09:11:23 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2016-05-02 08:55:36 -04:00
|
|
|
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
|
|
|
|
|
2013-08-26 09:11:23 -04:00
|
|
|
snippet exp "phpunit expects" i
|
|
|
|
expects($this->${1:once}())
|
|
|
|
->method('${2}')
|
|
|
|
->with($this->equalTo(${3})${4})
|
|
|
|
->will($this->returnValue(${5}));
|
|
|
|
endsnippet
|
2014-11-11 11:28:53 -05:00
|
|
|
|
|
|
|
snippet testcmt "phpunit comment with group" b
|
|
|
|
/**
|
|
|
|
* @group ${1}
|
|
|
|
*/
|
|
|
|
endsnippet
|
2016-05-02 08:55:36 -04:00
|
|
|
|
|
|
|
snippet fail "$this->fail()"
|
|
|
|
$this->fail(${1});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet marki "$this->markTestIncomplete()"
|
|
|
|
$this->markTestIncomplete(${1});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet marks "$this->markTestSkipped()"
|
|
|
|
$this->markTestSkipped(${1});
|
|
|
|
endsnippet
|