下記のようなテストコードでHoge.phpをテストする際、1,2以外の値もすべて(たとえば1,3とか100,90)も一度にテストするにはどのようなテストコードを書けばいいですか。
<?php class HogeTest extends PHPUnit_Framework_TestCase { public function testDoSomething() { $method = new ReflectionMethod( 'Hoge', 'doSomething' ); $method->setAccessible(true); $this->assertEquals(3, $method->invokeArgs(new Hoge(), array(1,2))); } }
Hoge.php
<?php class Hoge { public function __construct() { } private function doSomething($a, $b) { return $a + $b; } // テストでは使うけど、実際には使わない public function doSomething2($a, $b) { return $this->doSomething($a, $b); } }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。