Looking for some help to write better code /tests, but seemed to have stumbled across a problem straight away - any help would be greatly appreciated.
Script:
$feed = 'App\Http\Services\Supplier\Feeds\\' . ucwords($feedName) . "Feed";
if (class_exists($feed)) {
return new $feed($headerRowToSkip);
} else {
throw new Exception("Invalid feed type given.");
}
Test:
public function testBuild()
{
SupplierFeedFactory::build('MusicMagpie', 1);
$this->expectExceptionMessage("Invalid feed type given.");
}
Error:
There was 1 failure:
1) Tests\Feature\Account\Supplier\Feeds\SupplierFeedFactoryTest::testBuild Failed asserting that exception of type "Exception" is thrown.