Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class TestMyModel extends PHPUnit_Framework_TestCase{
- /**
- * @dataProvider myProvider
- */
- public function testMyFunctionOnlyAcceptsPositiveIntegers($a){
- if(!is_int($a) || $a < 0 || is_string($a)){
- $this->setExpectedException('\Exception');
- }
- $val = $this->model->myFunction($a);
- $this->assertEquals(true, $val);
- }
- public function myProvider(){
- return array(
- array(1),
- array(1.1),
- array('a'),
- array(-23)
- );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement