Closed aozen closed 1 year ago
Did you try adding on TestCase class
/**
* @param \Illuminate\Foundation\Application $app
* @return array
*/
protected function getPackageProviders($app)
{
return [
\OwenIt\Auditing\AuditingServiceProvider::class,
];
}
When testing with
pest
, Pest does not boot the Laravel application. So we may get the error if we use Auditable on our model. Like:Test.php
Post.php
Run test
Result:
It should be pass the booting app.
it goes the bootAuditable.
then
In
isAuditingEnabled
functionApp::runningInConsole()
is failing when using non-boot tools. BecauseApp
is not loaded yet. AlsoConfig
will not be able to load.Probably there is not perfect way to fix this. For testing purposes manually I added return true/false; in here.