PhpStorm Live Template & Postfix Snippets

All "Generate test" Snippets

@t

Generate an empty PhpUnit test with the @test annotation.

@t
<template name="@t" value="/**&#10;* @test&#10;*/&#10;public function $NAME$(): void {&#10;    $END$&#10;}" description="Add a test function" toReformat="true" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>

Do you speak French and want to stop hating your tests ?

A cover picture saying "Améliorez vos tests automatisés" with a burrito.

I've created a course to help developers to improve their automated tests.

I share ideas and technics to improve slow, flaky, failing for unexpected reason and hard to understand tests until they become tests we take joy to work with !

But you'll need to understand French...

@tl

Generate an empty PhpUnit test with the @test annotation and a fake name.

@tl
<template name="@tl" value="/**&#10;* @test&#10;*/&#10;public function TODO_RENAME_$LINE_NUMBER$(): void {&#10;    $END$&#10;}" description="Add a lazy named test" toReformat="true" toShortenFQNames="true">
<variable name="LINE_NUMBER" expression="lineNumber()" defaultValue="" alwaysStopAt="false" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>

@ts

Generate an empty skipped PhpUnit test with the @test annotation.

@ts
<template name="@ts" value="/**&#10;* @test&#10;*/&#10;public function $NAME$(): void {&#10;&#9;$this-&gt;markTestSkipped('Not implemented yet.');&#10;}&#10;&#10; $END$" description="Add a test function" toReformat="true" toShortenFQNames="true">
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>