Skip to content

Conversation

@dallincoons
Copy link
Contributor

This is a very simple, easy tweak. The goal is to allow for doing things like testing individual methods on an Eloquent Model without needing to load the framework, since running a test that boots the Laravel framework is typically three times slower than one that doesn't.

Because bootAuditable immediately calls isAuditingEnabled, which references the App facade, you can't instantiate a model in a Laravel-free test without getting an error having to do with the facade not being available.

This tweak allows the user to simply add Article::$auditingDisabled = true; to the beginning of the test, and the problem goes away.

@dallincoons dallincoons force-pushed the short-circuiting-trait-boot branch from 54a330c to d35323b Compare December 21, 2018 16:13
@anteriovieira
Copy link
Member

Thanks @dallincoons

@anteriovieira anteriovieira merged commit c66abe7 into owen-it:master Sep 12, 2019
@cwilby
Copy link

cwilby commented Jun 29, 2020

Missed this the first time around on this issue, thanks @dallincoons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants