diff --git a/UltiSnips/php-phpunit.snippets b/UltiSnips/php-phpunit.snippets deleted file mode 100644 index 73b03e2..0000000 --- a/UltiSnips/php-phpunit.snippets +++ /dev/null @@ -1,76 +0,0 @@ -# suggestion? report bugs? -# 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 - -snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }" -${1:once}()) - ->method('${2}') - ->with($this->equalTo(${3})${4}) - ->will($this->returnValue(${5})); -endsnippet - -snippet testcmt "phpunit comment with group" b -/** -* @group ${1} -*/ -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 diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 465a6c4..f2e7b64 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -363,4 +363,29 @@ snippet inheritdoc "@inheritdoc docblock" */ endsnippet +# PHPUnit snippets +snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }" +assertEquals()" $this->assertEquals(${1:expected}, ${2:actual}); - -snippet asne +snippet asne "$this->assertNotEquals()" $this->assertNotEquals(${1:expected}, ${2:actual}); - -snippet asf - $this->assertFalse(${1:Something}); - -snippet ast - $this->assertTrue(${1:Something}); - -snippet asfex - $this->assertFileExists(${1:path/to/file}); - -snippet asfnex - $this->assertFileNotExists(${1:path/to/file}); - -snippet ascon - $this->assertContains(${1:Search Value}, ${2:Array or Iterator}); - -snippet ashk - $this->assertArrayHasKey(${1:key}, ${2:array}); - -snippet asnhk - this->assertArrayNotHasKey(${1:value}, ${2:array}); - -snippet ascha - $this->assertClassHasAttribute('${1:Attribute Name}', '${2:ClassName}'); - -snippet asi +snippet asf "$this->assertFalse()" + $this->assertFalse(${1}); +snippet ast "$this->assertTrue()" + $this->assertTrue(${1}); +snippet asfex "$this->assertFileExists()" + $this->assertFileExists(${1:'path/to/file'}); +snippet asfnex "$this->assertFileNotExists()" + $this->assertFileNotExists(${1:'path/to/file'}); +snippet ascon "$this->assertContains()" + $this->assertContains(${1:$needle}, ${2:$haystack}); +snippet ashk "$this->assertArrayHasKey()" + $this->assertArrayHasKey(${1:$key}, ${2:$array}); +snippet asnhk "$this->assertArrayNotHasKey()" + this->assertArrayNotHasKey(${1:$key}, ${2:$array}); +snippet ascha "$this->assertClassHasAttribute()" + $this->assertClassHasAttribute(${1:$attributeName}, '${2:$className}'); +snippet asi "$this->assertInstanceOf(...)" $this->assertInstanceOf(${1:expected}, ${2:actual}); - -snippet tc - public function test${1:name_of_the_test}() +snippet test "public function testXYZ() { ... }" + public function test${1}() { - ${0:code} + ${0} } -snippet te +snippet setup "protected function setUp() { ... }" + protected function setUp() + { + ${0} + } +snippet teardown "protected function tearDown() { ... }" + protected function tearDown() + { + ${0} + } +snippet exp "phpunit expects" + expects($this->${1:once}()) + ->method('${2}') + ->with($this->equalTo(${3})${4}) + ->will($this->returnValue(${5})); +snippet testcmt "phpunit comment with group" + /** + * @group ${1} + */ +snippet fail "$this->fail()" + $this->fail(${1}); +snippet marki "$this->markTestIncomplete()" + $this->markTestIncomplete(${1}); +snippet marks "$this->markTestSkipped()" + $this->markTestSkipped(${1}); +# end of phpunit snippets +snippet te "throw new Exception()" throw new ${1:Exception}("${2:Error Processing Request}"); - snippet fpc "file_put_contents" b file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0 - snippet sr "str_replace" str_replace(${1:search}, ${2:replace}, ${3:subject})$0 - snippet ia "in_array" in_array(${1:needle}, ${2:haystack})$0 - snippet is "isset" isset(${1:var})$0 - snippet isa "isset array" isset($${1:array}[${2:key}])$0 - snippet in "is_null" is_null($${1:var})$0 - snippet fe "file_exists" file_exists(${1:file})$0 - snippet id "is_dir" is_dir(${1:path})$0