Last active
August 26, 2015 14:58
-
-
Save manuakasam/a258e093e2ae82c6e1a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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