Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kunicmarko20/744686a513a2a233b9623fa8166d4659 to your computer and use it in GitHub Desktop.

Select an option

Save kunicmarko20/744686a513a2a233b9623fa8166d4659 to your computer and use it in GitHub Desktop.
PHPStorm code template for phpunit tests
<?php
declare(strict_types=1);
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
use ${TESTED_NAMESPACE}\\${TESTED_NAME};
use PHPUnit\Framework\TestCase;
/**
* @covers \\${TESTED_NAMESPACE}\\${TESTED_NAME}
*/
final class ${NAME} extends TestCase
{
#set($name = ${TESTED_NAME})
#set($firstLetter = $name.substring(0, 1).toLowerCase())
#set($propertyName = $firstLetter + $name.substring(1))
/**
* @var ${TESTED_NAME}
*/
private $$propertyName;
protected function setUp(): void
{
$this->$propertyName = new ${TESTED_NAME}();
}
/**
* @test
*/
public function your_test_here(): void
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment