File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ trait Auditable
4646 */
4747 public static function bootAuditable ()
4848 {
49- if (static ::isAuditingEnabled ()) {
49+ if (! self :: $ auditingDisabled && static ::isAuditingEnabled ()) {
5050 static ::observe (new AuditableObserver ());
5151 }
5252 }
Original file line number Diff line number Diff line change @@ -66,6 +66,23 @@ public function itWillAlwaysAuditModelsWhenNotRunningFromTheConsole()
6666 $ this ->assertTrue (Article::isAuditingEnabled ());
6767 }
6868
69+ /**
70+ * @group Auditable::bootAuditable
71+ * @test
72+ */
73+ public function itWillNotBootTraitWhenStaticFlagIsSet ()
74+ {
75+ App::spy ();
76+
77+ Article::$ auditingDisabled = true ;
78+
79+ new Article ();
80+
81+ App::shouldNotHaveReceived ('runningInConsole ' );
82+
83+ Article::$ auditingDisabled = false ;
84+ }
85+
6986 /**
7087 * @group Auditable::getAuditEvent
7188 * @test
You can’t perform that action at this time.
0 commit comments