I have the following code to test if the class constructor will fire the exception but PHPUnit test fail on it. I am trying to figure out what I am doing wrong.
/** @test */
public function should_require_instance_of_uuid()
{
$this->setExpectedException('Exception');
$id = new BusinessPartnerId;
}
PHPunit gives the following error: There was 1 error: 1) Tests\Domain\Model\Common\BusinessPartner\BusinessPartnerIdTest::should_require_instance_of_uuid Argument 1 passed to Domain\Model\Common\BusinessPartner\BusinessPartnerId::__construct() must be an instance of Rhumsaa\Uuid\Uuid, none given, called in tests/Comain/Model/Common/BusinessPartner/BusinesPartnerIdTest.php on line 14 and defined
Domain/Model/Common/BusinessPartner/BusinessPartnerId.php:20 tests/Domain/Model/Common/BusinessPartner/BusinesPartnerIdTest.php:14
I am not sure why this test is not passing? I have also tried:
$this->setExpectedException('InvalidArgumentException');