Created
September 4, 2012 21:47
-
-
Save andersonfraga/3627001 to your computer and use it in GitHub Desktop.
Sublime Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[${1:namespace ${2:Bar\Foo}; | |
} | |
class ${3:ClassName}${4: extends ${5:AnotherClass}} | |
{ | |
${6:/*** | |
* $7 | |
*/} | |
function ${8:__construct}(${9:argument}) { | |
${0:# code...} | |
} | |
};]]></content> | |
<tabTrigger>class</tabTrigger> | |
<scope>source.php</scope> | |
<description>class …</description> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
phpunit-test-with-data | |
A time-saving snippet for adding new tests with a data provider to your unit test class | |
HOW TO USE | |
In your PHP class, simply type the following: | |
phpunit-test-with-data<TAB><testcase-name> | |
Sublime Text will add the new test method to your file, and | |
give the method the name that you choose. | |
--> | |
<snippet> | |
<content><![CDATA[ | |
/** | |
* ${3:[testcase-description]} | |
* | |
* @dataProvider ${1:[dataProviderMethod]} | |
* | |
* @return void | |
*/ | |
public function test${2:[testcase-name]}() | |
{ | |
// setup your test | |
// pre-conditions | |
// perform the change | |
// test the results | |
} | |
/** | |
* Data Provider for test$2 | |
* | |
* @return array | |
*/ | |
public function ${1:[dataProviderMethod]}() | |
{ | |
return array( | |
array() | |
); | |
} | |
]]></content> | |
<!-- Optional: Tab trigger to activate the snippet --> | |
<tabTrigger>testdata</tabTrigger> | |
<!-- Optional: Scope the tab trigger will be active in --> | |
<scope>source.php</scope> | |
<!-- Optional: Description to show in the menu --> | |
<description>Create a skeleton test method with a data provider</description> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
phpunit-test | |
A time-saving snippet for adding new tests to your unit test class | |
HOW TO USE | |
In your PHP class, simply type the following: | |
phpunit-test<TAB><testcase-name> | |
Sublime Text will add the new test method to your file, and | |
give the method the name that you choose. | |
--> | |
<snippet> | |
<content><![CDATA[ | |
public function test${1:[testcase-name]}() | |
{ | |
// ---------------------------------------------------------------- | |
// setup your test | |
// | |
// explain your test setup here if needed ... | |
// ---------------------------------------------------------------- | |
// perform the change | |
// | |
// explain your test here if needed ... | |
// ---------------------------------------------------------------- | |
// test the results | |
// | |
// explain what you expect to have happened | |
} | |
]]></content> | |
<!-- Optional: Tab trigger to activate the snippet --> | |
<tabTrigger>test</tabTrigger> | |
<!-- Optional: Scope the tab trigger will be active in --> | |
<scope>source.php</scope> | |
<!-- Optional: Description to show in the menu --> | |
<description>Create a skeleton test method</description> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
phpunit-testsuite | |
A time-saving device for creating skeleton PHPUnit TestCase classes | |
HOW TO USE | |
In your PHP class, simply type the following: | |
phpunit-testcase<TAB><classname> | |
Sublime Text will add the new TestCase class to your file, and | |
give the class the name that you choose. | |
--> | |
<snippet> | |
<content><![CDATA[ | |
class ${1:[ClassName]}Test extends PHPUnit_Framework_TestCase { | |
public function setUp() { | |
// your code here | |
} | |
public function tearDown() { | |
// your code here | |
} | |
public function test${2:[testcase-name]}() { | |
// ---------------------------------------------------------------- | |
// setup your test | |
// | |
// explain your test setup here if needed ... | |
// ---------------------------------------------------------------- | |
// perform the change | |
// | |
// explain your test here if needed ... | |
// ---------------------------------------------------------------- | |
// test the results | |
// | |
// explain what you expect to have happened | |
} | |
}; | |
]]></content> | |
<!-- Optional: Tab trigger to activate the snippet --> | |
<tabTrigger>testcase</tabTrigger> | |
<!-- Optional: Scope the tab trigger will be active in --> | |
<scope>source.php</scope> | |
<!-- Optional: Description to show in the menu --> | |
<description>Create a skeleton TestCase class</description> | |
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[return ($1) ? $2 : $3;$0]]></content> | |
<tabTrigger>ret?</tabTrigger> | |
<scope>source.php</scope> | |
<description>return ternary</description> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment