Tests\BarTest::should_receive_parameter Missing argument 1 for
Itdc\Foo\Bar::__construct(),called in
/mypath/foo/tests/BarTest.PHP on line 10 and
defined
<?PHP namespace Tests; use Itdc\Foo\Bar; class BarTest extends \PHPUnit_Framework_TestCase { /** @test */ public function should_receive_parameter() { $this->setExpectedException('Exception'); $id = new Bar; } }
这是Bar类:
<?PHP namespace Itdc\Foo; class Bar { public function __construct($a) { // do something } }
我试图在注释部分puth setExpectedException,也试图使用InvalidArgumentException,但没有运气.
任何建议我做错了将不胜感激.