I try to check my class for an InvalidArgumentException, but I get
Tests \ BarTest :: should_receive_parameter Missing argument 1 for Itdc \ Foo \ Bar :: __ construct (), called in /mypath/foo/tests/BarTest.php on line 10 and is defined
This is the test file (BarTest.php) that I use:
<?php namespace Tests;
use Itdc\Foo\Bar;
class BarTest extends \PHPUnit_Framework_TestCase {
public function should_receive_parameter() {
$this->setExpectedException('Exception');
$id = new Bar;
}
}
This is the Bar class:
<?php namespace Itdc\Foo;
class Bar {
public function __construct($a) {
}
}
I tried puth setExpectedException in the comments section, also tried to use an InvalidArgumentException, but no luck.
Any suggestions on what I am doing wrong will be appreciated.
source
share