Skip to content

Commit

Permalink
Added completions for PHPUnit 3.7 asertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Grimshaw committed Nov 30, 2012
1 parent 0988de3 commit ccb52b5
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 16 deletions.
99 changes: 99 additions & 0 deletions PHPUnit-Assertions.sublime-completions
@@ -0,0 +1,99 @@
{
"scope": "source.php",

"completions":
[
"phpunit",

{ "trigger": "assAHK", "contents": "\\$this->assertArrayHasKey('${1:key}',\\$${2:array}${3:, '${4}'});" },
{ "trigger": "assANHK", "contents": "\\$this->assertArrayNotHasKey('${1:key}',\\$${2:array}, '${3}');" },
{ "trigger": "assAC", "contents": "\\$this->assertAttributeContains(${1:needle},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, '${4}', ${5:FALSE}, ${6:TRUE});" },
{ "trigger": "assACO", "contents": "\\$this->assertAttributeContainsOnly(${1:type},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, $isNativeType = NULL, '${4}');" },
{ "trigger": "assACo", "contents": "\\$this->assertAttributeCount(${1:expectedCount},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, '${4}');" },
{ "trigger": "assAE", "contents": "\\$this->assertAttributeEmpty(${1:haystackAttributeName},\\$${2:haystackClassOrObject}, '${3}');" },
{ "trigger": "assAEq", "contents": "\\$this->assertAttributeEquals(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}', ${5:0}, ${6:10}, ${7:FALSE}, ${8:FALSE});" },
{ "trigger": "assAGT", "contents": "\\$this->assertAttributeGreaterThan(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assAGTE", "contents": "\\$this->assertAttributeGreaterThanOrEqual(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assAIO", "contents": "\\$this->assertAttributeInstanceOf(${1:expected},\\$${2:attributeName},\\$${3:classOrObject}, '${4}');" },
{ "trigger": "assAIT", "contents": "\\$this->assertAttributeInternalType(${1:expected},\\$${2:attributeName},\\$${3:classOrObject}, '${4}');" },
{ "trigger": "assALT", "contents": "\\$this->assertAttributeLessThan(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assALTE", "contents": "\\$this->assertAttributeLessThanOrEqual(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assANC", "contents": "\\$this->assertAttributeNotContains(${1:needle},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, '${4}', ${5:FALSE}, ${6:TRUE});" },
{ "trigger": "assANCO", "contents": "\\$this->assertAttributeNotContainsOnly(${1:type},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, ${4:NULL}, '${5}');" },
{ "trigger": "assANC", "contents": "\\$this->assertAttributeNotCount(${1:expectedCount},\\$${2:haystackAttributeName},\\$${3:haystackClassOrObject}, '${4}');" },
{ "trigger": "assANE", "contents": "\\$this->assertAttributeNotEmpty(${1:haystackAttributeName},\\$${2:haystackClassOrObject}, '${3}');" },
{ "trigger": "assANEq", "contents": "\\$this->assertAttributeNotEquals(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}', ${5:0}, ${6:10}, ${7:FALSE}, ${8:FALSE});" },
{ "trigger": "assANIO", "contents": "\\$this->assertAttributeNotInstanceOf(${1:expected},\\$${2:attributeName},\\$${3:classOrObject}, '${4}');" },
{ "trigger": "assANIT", "contents": "\\$this->assertAttributeNotInternalType(${1:expected},\\$${2:attributeName},\\$${3:classOrObject}, '${4}');" },
{ "trigger": "assANS", "contents": "\\$this->assertAttributeNotSame(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assAS", "contents": "\\$this->assertAttributeSame(${1:expected},\\$${2:actualAttributeName},\\$${3:actualClassOrObject}, '${4}');" },
{ "trigger": "assCHA", "contents": "\\$this->assertClassHasAttribute(${1:attributeName},\\$${2:className}, '${3}');" },
{ "trigger": "assCHSA", "contents": "\\$this->assertClassHasStaticAttribute(${1:attributeName},\\$${2:className}, '${3}');" },
{ "trigger": "assCNHA", "contents": "\\$this->assertClassNotHasAttribute(${1:attributeName},\\$${2:className}, '${3}');" },
{ "trigger": "assCNHSA", "contents": "\\$this->assertClassNotHasStaticAttribute(${1:attributeName},\\$${2:className}, '${3}');" },
{ "trigger": "assC", "contents": "\\$this->assertContains(${1:needle},\\$${2:haystack}, '${3}', ${4:FALSE}, ${5:TRUE});" },
{ "trigger": "assCO", "contents": "\\$this->assertContainsOnly(${1:type},\\$${2:haystack}, ${3:isNativeType}, '${4}');" },
{ "trigger": "assCOIO", "contents": "\\$this->assertContainsOnlyInstancesOf(${1:classname},\\$${2:haystack}, '${3}');" },
{ "trigger": "assCo", "contents": "\\$this->assertCount(${1:expectedCount},\\$${2:haystack}, '${3}');" },
{ "trigger": "assEm", "contents": "\\$this->assertEmpty(${1:actual}, '${2}');" },
{ "trigger": "assEXS", "contents": "\\$this->assertEqualXMLStructure(${1:$expectedElement}, ${2:$actualElement}, ${3:FALSE}, '${4}');" },
{ "trigger": "assEq", "contents": "\\$this->assertEquals(${1:expected},\\$${2:actual}, '${3}', $(4:delta}, ${5:maxDepth}, ${6:FALSE}, ${7:FALSE});" },
{ "trigger": "assF", "contents": "\\$this->assertFalse(${1:condition}, '${2}');" },
{ "trigger": "assFEq", "contents": "\\$this->assertFileEquals(${1:expected},\\$${2:actual}, '${3}', ${4:canonicalize}, ${5:FALSE});" },
{ "trigger": "assFEx", "contents": "\\$this->assertFileExists(${1:filename}, '${2}');" },
{ "trigger": "assFNEq", "contents": "\\$this->assertFileNotEquals(${1:expected},\\$${2:actual}, '${3}', ${4:FALSE}, ${5:FALSE});" },
{ "trigger": "assFNEx", "contents": "\\$this->assertFileNotExists(${1:filename}, '${2}');" },
{ "trigger": "assGT", "contents": "\\$this->assertGreaterThan(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assGTE", "contents": "\\$this->assertGreaterThanOrEqual(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assIO", "contents": "\\$this->assertInstanceOf(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assIT", "contents": "\\$this->assertInternalType(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assJFEJF", "contents": "\\$this->assertJsonFileEqualsJsonFile(${1:expectedFile},\\$${2:actualFile}, '${3}');" },
{ "trigger": "assJFNEJF", "contents": "\\$this->assertJsonFileNotEqualsJsonFile(${1:expectedFile},\\$${2:actualFile}, '${3}');" },
{ "trigger": "assJSEJF", "contents": "\\$this->assertJsonStringEqualsJsonFile(${1:expectedFile},\\$${2:actualJson}, '${3}');" },
{ "trigger": "assJSEJS", "contents": "\\$this->assertJsonStringEqualsJsonString(${1:expectedJson},\\$${2:actualJson}, '${3}');" },
{ "trigger": "assJSNEJF", "contents": "\\$this->assertJsonStringNotEqualsJsonFile(${1:expectedFile},\\$${2:actualJson}, '${3}');" },
{ "trigger": "assJSNEJS", "contents": "\\$this->assertJsonStringNotEqualsJsonString(${1:expectedJson},\\$${2:actualJson}, '${3}');" },
{ "trigger": "assLT", "contents": "\\$this->assertLessThan(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assLTE", "contents": "\\$this->assertLessThanOrEqual(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assNC", "contents": "\\$this->assertNotContains(${1:needle},\\$${2:haystack}, '${3}', ${4:FALSE}, ${5:TRUE});" },
{ "trigger": "assNCO", "contents": "\\$this->assertNotContainsOnly(${1:type},\\$${2:haystack}, ${3:isNativeType}, '${4}');" },
{ "trigger": "assNCnt", "contents": "\\$this->assertNotCount(${1:expectedCount},\\$${2:haystack}, '${3}');" },
{ "trigger": "assNEm", "contents": "\\$this->assertNotEmpty(${1:actual}, '${2}');" },
{ "trigger": "assNEq", "contents": "\\$this->assertNotEquals(${1:expected},\\$${2:actual}, '${3}', ${4:delta}, ${5:maxDepth}, ${6:FALSE}, ${7:FALSE});" },
{ "trigger": "assNIO", "contents": "\\$this->assertNotInstanceOf(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assNIT", "contents": "\\$this->assertNotInternalType(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assNN", "contents": "\\$this->assertNotNull(${1:actual}, '${2}');" },
{ "trigger": "assNRE", "contents": "\\$this->assertNotRegExp(${1:pattern},\\$${2:string}, '${3}');" },
{ "trigger": "assNS", "contents": "\\$this->assertNotSame(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assNSS", "contents": "\\$this->assertNotSameSize(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assNT", "contents": "\\$this->assertNotTag(${1:matcher},\\$${2:actual}, '${3}', ${4:TRUE});" },
{ "trigger": "assN", "contents": "\\$this->assertNull(${1:actual}, '${2}');" },
{ "trigger": "assOHA", "contents": "\\$this->assertObjectHasAttribute(${1:attributeName},\\$${2:object}, '${3}');" },
{ "trigger": "assONHA", "contents": "\\$this->assertObjectNotHasAttribute(${1:attributeName},\\$${2:object}, '${3}');" },
{ "trigger": "assRE", "contents": "\\$this->assertRegExp(${1:pattern},\\$${2:string}, '${3}');" },
{ "trigger": "assS", "contents": "\\$this->assertSame(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assSS", "contents": "\\$this->assertSameSize(${1:expected},\\$${2:actual}, '${3}');" },
{ "trigger": "assSC", "contents": "\\$this->assertSelectCount(${1:selector},\\$${2:count},\\$${3:actual}, '${4}', ${5:TRUE});" },
{ "trigger": "assSEq", "contents": "\\$this->assertSelectEquals(${1:selector},\\$${2:content},\\$${3:count},\\$${4:actual}, '${5}', ${6:TRUE});" },
{ "trigger": "assSRE", "contents": "\\$this->assertSelectRegExp(${1:selector},\\$${2:content},\\$${3:count},\\$${4:actual}, '${5}', ${6:TRUE});" },
{ "trigger": "assSENW", "contents": "\\$this->assertStringEndsNotWith(${1:suffix},\\$${2:string}, '${3}');" },
{ "trigger": "assSEW", "contents": "\\$this->assertStringEndsWith(${1:suffix},\\$${2:string}, '${3}');" },
{ "trigger": "assSEF", "contents": "\\$this->assertStringEqualsFile(${1:expectedFile},\\$${2:actualString}, '${3}', ${4:FALSE}, ${5:FALSE});" },
{ "trigger": "assSMF", "contents": "\\$this->assertStringMatchesFormat(${1:format},\\$${2:string}, '${3}');" },
{ "trigger": "assSMFF", "contents": "\\$this->assertStringMatchesFormatFile(${1:formatFile},\\$${2:string}, '${3}');" },
{ "trigger": "assSNEF", "contents": "\\$this->assertStringNotEqualsFile(${1:expectedFile},\\$${2:actualString}, '${3}', ${4:FALSE}, ${5:FALSE});" },
{ "trigger": "assSNMF", "contents": "\\$this->assertStringNotMatchesFormat(${1:format},\\$${2:string}, '${3}');" },
{ "trigger": "assSNMFF", "contents": "\\$this->assertStringNotMatchesFormatFile(${1:formatFile},\\$${2:string}, '${3}');" },
{ "trigger": "assSSNW", "contents": "\\$this->assertStringStartsNotWith(${1:prefix},\\$${2:string}, '${3}');" },
{ "trigger": "assSSW", "contents": "\\$this->assertStringStartsWith(${1:prefix},\\$${2:string}, '${3}');" },
{ "trigger": "assTag", "contents": "\\$this->assertTag(${1:matcher},\\$${2:actual}, '${3}', ${4:TRUE});" },
{ "trigger": "assThat", "contents": "\\$this->assertThat(${1:value}, ${2:constraint}, '${3}');" },
{ "trigger": "assT", "contents": "\\$this->assertTrue(${1:condition}, '${2}');" },
{ "trigger": "assXFEXF", "contents": "\\$this->assertXmlFileEqualsXmlFile(${1:expectedFile},\\$${2:actualFile}, '${3}');" },
{ "trigger": "assXFNEXF", "contents": "\\$this->assertXmlFileNotEqualsXmlFile(${1:expectedFile},\\$${2:actualFile}, '${3}');" },
{ "trigger": "assXSEXF", "contents": "\\$this->assertXmlStringEqualsXmlFile(${1:expectedFile},\\$${2:actualXml}, '${3}');" },
{ "trigger": "assXSEXS", "contents": "\\$this->assertXmlStringEqualsXmlString(${1:expectedXml},\\$${2:actualXml}, '${3}');" },
{ "trigger": "assXSNEXF", "contents": "\\$this->assertXmlStringNotEqualsXmlFile(${1:expectedXml},\\$${2:actualXml}, '${3}');" },
{ "trigger": "assXSNEXS", "contents": "\\$this->assertXmlStringNotEqualsXmlString(${1:expectedXml},\\$${2:actualXml}, '${3}');" }
]
}
16 changes: 0 additions & 16 deletions PHPUnit.sublime-completions

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -44,6 +44,11 @@ To use any of the snippets, simply type the name of the snippet, then press the
* __phpunit-test__: create a new test method inside your TestCase class
* __phpunit-testcase__: create a new TestCase class to put your tests inside

Completions
-----------

This plugin provides completions for all of PHPUnit 3.7's assertions, with tab stops for each parameter.

Contributions Welcome
---------------------

Expand Down

0 comments on commit ccb52b5

Please sign in to comment.