@@ -996,7 +996,7 @@ public function itFailsToTransitionWhenTheAuditAuditableTypeDoesNotMatchTheModel
996996 $ this ->expectException (AuditableTransitionException::class);
997997 $ this ->expectExceptionMessage ('Expected Auditable type OwenIt\Auditing\Tests\Models\Article, got OwenIt\Auditing\Tests\Models\User instead ' );
998998
999- $ audit = factory ( Audit::class)-> make ([
999+ $ audit = new Audit ([
10001000 'auditable_type ' => User::class,
10011001 ]);
10021002
@@ -1052,7 +1052,7 @@ public function itFailsToTransitionWhenTheAuditAuditableTypeDoesNotMatchTheMorph
10521052 'articles ' => Article::class,
10531053 ]);
10541054
1055- $ audit = factory ( Audit::class)-> make ([
1055+ $ audit = new Audit ([
10561056 'auditable_type ' => 'users ' ,
10571057 ]);
10581058
@@ -1092,7 +1092,8 @@ public function itFailsToTransitionWhenTheAuditAuditableIdTypeDoesNotMatchTheMod
10921092
10931093 $ model = factory (Article::class)->create ();
10941094
1095- $ audit = factory (Audit::class)->create ([
1095+ $ audit = Audit::create ([
1096+ 'event ' => 'updated ' ,
10961097 'auditable_type ' => Article::class,
10971098 'auditable_id ' => (string )$ model ->id ,
10981099 ]);
@@ -1125,7 +1126,8 @@ public function itTransitionsWhenTheAuditAuditableIdTypeDoesNotMatchTheModelIdTy
11251126 $ key = (int )$ model ->id ;
11261127 }
11271128
1128- $ audit = factory (Audit::class)->create ([
1129+ $ audit = Audit::create ([
1130+ 'event ' => 'updated ' ,
11291131 'auditable_type ' => Article::class,
11301132 'auditable_id ' => $ key ,
11311133 ]);
@@ -1148,8 +1150,9 @@ public function itFailsToTransitionWhenAnAttributeRedactorIsSet()
11481150 'title ' => RightRedactor::class,
11491151 ];
11501152
1151- $ audit = factory (Audit::class)->create ([
1152- 'auditable_id ' => $ model ->getKey (),
1153+ $ audit = Audit::create ([
1154+ 'event ' => 'created ' ,
1155+ 'auditable_id ' => $ model ->getKey (),
11531156 'auditable_type ' => Article::class,
11541157 ]);
11551158
@@ -1164,9 +1167,9 @@ public function itFailsToTransitionWhenTheAuditableAttributeCompatibilityIsNotMe
11641167 {
11651168 $ model = factory (Article::class)->create ();
11661169
1167- $ incompatibleAudit = factory ( Audit::class)-> create ([
1168- 'event ' => 'created ' ,
1169- 'auditable_id ' => $ model ->getKey (),
1170+ $ incompatibleAudit = Audit::create ([
1171+ 'event ' => 'created ' ,
1172+ 'auditable_id ' => $ model ->getKey (),
11701173 'auditable_type ' => Article::class,
11711174 'old_values ' => [],
11721175 'new_values ' => [
@@ -1175,19 +1178,25 @@ public function itFailsToTransitionWhenTheAuditableAttributeCompatibilityIsNotMe
11751178 ],
11761179 ]);
11771180
1181+ $ exceptionWasThrown = false ;
1182+
11781183 try {
11791184 $ model ->transitionTo ($ incompatibleAudit );
11801185 } catch (AuditableTransitionException $ e ) {
11811186 $ this ->assertSame (
1182- 'Incompatibility between [OwenIt\Auditing\Tests\Models\Article:1] and [OwenIt\Auditing\Models\Audit:3 ] ' ,
1187+ 'Incompatibility between [OwenIt\Auditing\Tests\Models\Article:1] and [OwenIt\Auditing\Models\Audit:2 ] ' ,
11831188 $ e ->getMessage ()
11841189 );
11851190
11861191 self ::Assert ()::assertArraySubset ([
11871192 'subject ' ,
11881193 'text ' ,
11891194 ], $ e ->getIncompatibilities (), true );
1195+
1196+ $ exceptionWasThrown = true ;
11901197 }
1198+
1199+ $ this ->assertTrue ($ exceptionWasThrown );
11911200 }
11921201
11931202 /**
@@ -1223,8 +1232,9 @@ public function itTransitionsToAnotherModelState(
12231232 $ auditableType = $ morphMap ? 'articles ' : Article::class;
12241233
12251234 $ audits = $ models ->map (function (Article $ model ) use ($ auditableType , $ oldValues , $ newValues ) {
1226- return factory (Audit::class)->create ([
1227- 'auditable_id ' => $ model ->getKey (),
1235+ return Audit::create ([
1236+ 'event ' => 'updated ' ,
1237+ 'auditable_id ' => $ model ->getKey (),
12281238 'auditable_type ' => $ auditableType ,
12291239 'old_values ' => $ oldValues ,
12301240 'new_values ' => $ newValues ,
0 commit comments