View difference between Paste ID: rWR5SvVN and cbNPBqsN
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
class TestMyModel extends PHPUnit_Framework_TestCase{
4
	/**
5
     	* @dataProvider myProvider
6
     	*/
7-
	public function testMyFunctionOnlyAcceptsPositiveIntegers($a){
7+
	public function testMyFunctionOnlyAcceptsPositiveIntegers($setter, $getter, $a)
8
        {
9
		if(!is_int($a) || $a < 0 || is_string($a)){
10
			$this->setExpectedException('\Exception');
11
		}
12-
		$val = $this->model->myFunction($a);
12+
13-
		$this->assertEquals(true, $val);
13+
		$val = $this->model->{$setter}($a);
14
		$this->assertEquals(true, $this->model->{$getter}());
15
	}
16
17
	public function myProvider(){
18-
			array(1),
18+
19-
			array(1.1),
19+
			array('setterA', 'getterA', 1),
20-
			array('a'),
20+
			array('setterB', 'getterB', 1.1),
21-
			array(-23)
21+
			array('setterC', 'getterC', 'a'),
22
			array('setterD', 'getterD', -23)
23
		);
24
	}
25
}
26
27
?>