I am trying to test my class for 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 defined
This is the test (BarTest.php) file I use:
<?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;
}
}
This is Bar class:
<?php namespace Itdc\Foo;
class Bar {
public function __construct($a) {
// do something
}
}
I have tried to puth setExpectedException in comment section, also tried to use InvalidArgumentException, but no luck.
Any suggetions what I am doing wrong would be appreciated.