Skip to content

Instantly share code, notes, and snippets.

@dancourse
Created April 2, 2015 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dancourse/5ee17a596223c10d5648 to your computer and use it in GitHub Desktop.
Save dancourse/5ee17a596223c10d5648 to your computer and use it in GitHub Desktop.
Simple PHPunit provider example
class ScoringTest extends TestCase
{
/**
* Some Grades
*/
public static function all_grades_provider()
{
return [
[100.00],
[50.00],
[0],
];
}
/**
* Grade checks
* @dataProvider all_grades_provider
* @return void
*/
public function test_grade_score_is_correct ($grade)
{
// test our total is correct
$this->assertEquals($grade, Score::someFunctionWhichAffectsGrade($grade));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment