Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created April 10, 2013 18:07
Show Gist options
  • Save phpfiddle/5357022 to your computer and use it in GitHub Desktop.
Save phpfiddle/5357022 to your computer and use it in GitHub Desktop.
Enhance-PHP test sample.
<?php
/**
* Enhance-PHP test sample
*
*/
include_once "enhancephp/EnhanceTestFramework.php";
// your classes and test fixtures
class ExampleClass
{
public function addTwoNumbers($a, $b)
{
return $a + $b;
}
}
class ExampleClassTests extends \Enhance\TestFixture
{
private $target;
public function setUp()
{
$this->target = \Enhance\Core::getCodeCoverageWrapper('ExampleClass');
}
public function addTwoNumbersWith3and2Expect5()
{
$result = $this->target->addTwoNumbers(3, 2);
\Enhance\Assert::areIdentical(5, $result);
}
public function addTwoNumbersWith4and2Expect6()
{
$result = $this->target->addTwoNumbers(4, 2);
\Enhance\Assert::areIdentical(6, $result);
}
}
// Run the tests
\Enhance\Core::runTests();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment