Skip to content

Instantly share code, notes, and snippets.

@twesolowski
Created March 15, 2017 10:04
Show Gist options
  • Save twesolowski/da7f09888aaa4ccb5274cce88c04e4b3 to your computer and use it in GitHub Desktop.
Save twesolowski/da7f09888aaa4ccb5274cce88c04e4b3 to your computer and use it in GitHub Desktop.
PHPUnit Template Methods Test
<?php
use PHPUnit\Framework\TestCase;
class TemplateMethodsTest extends TestCase
{
public static function setUpBeforeClass()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
protected function setUp()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
protected function assertPreConditions()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
public function testOne()
{
fwrite(STDOUT, __METHOD__ . "\n");
$this->assertTrue(true);
}
public function testTwo()
{
fwrite(STDOUT, __METHOD__ . "\n");
$this->assertTrue(false);
}
protected function assertPostConditions()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
protected function tearDown()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
public static function tearDownAfterClass()
{
fwrite(STDOUT, __METHOD__ . "\n");
}
protected function onNotSuccessfulTest(Exception $e)
{
fwrite(STDOUT, __METHOD__ . "\n");
throw $e;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment