BDD-like PHPUnit snippet for Sublime Text
June 11, 2014
While I'm trying to figure out how to obtain the same result in PHPStorm I've created a Sublime Text snippet to have PHPUnit test methods read like this
/**
* @test
* it should do something
*/
public function it_should_do_something()
{
$this->markTestIncomplete();
}
The reason is that I like phpspec test method naming convention, behaviour oriented, in place of the classic testSomething
PHPUnit one.
I will update testify in a short time but right now here it is the snippet code:
<snippet>
<content><![CDATA[
/**
* @test
* it should ${1:do something}
*/
public function it_should_${1/\s/_/g}()
{
\$this->markTestIncomplete();
}
]]></content>
<tabTrigger>should</tabTrigger>
<scope>source.php</scope>
</snippet>
what's typed in the test doc block will be transformed in the underscore separated method name.