laracasts/TestDummy

Usage within packages

Closed this issue · 2 comments

TestDummy currently cannot be used within packages easily for a number of reasons:

namespacing within DbTestCase.php refers to several items that are available only in the Laravel global namespace and available when testing from a package.

use TestCase, Artisan, DB;

Setting the $factoriesPath static attribute on Factory is not possible before the .../tests/factories/someFile.php is processed. Producing a Undefined variable: factory notice.

I may be approaching this wrong.

How did you end up fixing this @andrewmclagan?

Without going into too much detail look at one of my repos, specifically this class and the composer.json files:

https://github.com/Jiro-Commerce/Product/blob/master/tests/TestCase.php

https://github.com/Jiro-Commerce/Product/blob/master/composer.json