Skip to content

Instantly share code, notes, and snippets.

@manuakasam
Last active August 26, 2015 14:58
Show Gist options
  • Save manuakasam/a258e093e2ae82c6e1a6 to your computer and use it in GitHub Desktop.
Save manuakasam/a258e093e2ae82c6e1a6 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
public function doStuff($i) {
if ($i < 10) {
return "{$i}";
} else {
return $this->protectedStuff($i);
}
}
protected function protectedStuff($i) {
return "<strong>{$i}</strong>";
}
}
<?php
class FooTest
{
public function fooProvider() {
return [
[-5, "-5"],
[0, "0"],
[1, "1"],
[9, "9"],
[10, "<strong>10</strong>"],
[20, "<strong>20</strong>"],
[30, "<strong>30</strong>"],
];
}
/**
* @dataProvider fooProvider
**/
public function testStuff($input, $expectedOutput) {
$foo = new Foo();
$this->assertEquals($expectedOutput, $foo->doStuff($input));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment