@@ -209,7 +209,6 @@ public function testCustomPivotClassUsingUpdateExistingPivot()
209
209
);
210
210
}
211
211
212
- /** @group SkipMSSQL */
213
212
public function testCustomPivotClassUpdatesTimestamps ()
214
213
{
215
214
Carbon::setTestNow ('2017-10-10 10:10:10 ' );
@@ -233,8 +232,14 @@ public function testCustomPivotClassUpdatesTimestamps()
233
232
);
234
233
foreach ($ post ->tagsWithCustomExtraPivot as $ tag ) {
235
234
$ this ->assertSame ('exclude ' , $ tag ->pivot ->flag );
236
- $ this ->assertSame ('2017-10-10 10:10:10 ' , $ tag ->pivot ->getAttributes ()['created_at ' ]);
237
- $ this ->assertSame ('2017-10-10 10:10:20 ' , $ tag ->pivot ->getAttributes ()['updated_at ' ]); // +10 seconds
235
+
236
+ if ($ this ->driver === 'sqlsrv ' ) {
237
+ $ this ->assertSame ('2017-10-10 10:10:10.000 ' , $ tag ->pivot ->getAttributes ()['created_at ' ]);
238
+ $ this ->assertSame ('2017-10-10 10:10:20.000 ' , $ tag ->pivot ->getAttributes ()['updated_at ' ]); // +10 seconds
239
+ } else {
240
+ $ this ->assertSame ('2017-10-10 10:10:10 ' , $ tag ->pivot ->getAttributes ()['created_at ' ]);
241
+ $ this ->assertSame ('2017-10-10 10:10:20 ' , $ tag ->pivot ->getAttributes ()['updated_at ' ]); // +10 seconds
242
+ }
238
243
}
239
244
}
240
245
@@ -528,7 +533,6 @@ public function testFirstOrCreateMethod()
528
533
529
534
public function testFirstOrCreateUnrelatedExisting ()
530
535
{
531
- /** @var Post $post */
532
536
$ post = Post::create (['title ' => Str::random ()]);
533
537
534
538
$ name = Str::random ();
@@ -791,53 +795,54 @@ public function testNoTouchingHappensIfNotConfigured()
791
795
$ this ->assertNotSame ('2017-10-10 10:10:10 ' , $ tag ->fresh ()->updated_at ->toDateTimeString ());
792
796
}
793
797
794
- /** @group SkipMSSQL */
795
798
public function testCanRetrieveRelatedIds ()
796
799
{
797
800
$ post = Post::create (['title ' => Str::random ()]);
798
801
799
802
DB ::table ('tags ' )->insert ([
800
- ['id ' => 200 , ' name ' => 'excluded ' ],
801
- ['id ' => 300 , ' name ' => Str::random ()],
803
+ ['name ' => 'excluded ' ],
804
+ ['name ' => Str::random ()],
802
805
]);
803
806
804
807
DB ::table ('posts_tags ' )->insert ([
805
- ['post_id ' => $ post ->id , 'tag_id ' => 200 , 'flag ' => '' ],
806
- ['post_id ' => $ post ->id , 'tag_id ' => 300 , 'flag ' => 'exclude ' ],
807
- ['post_id ' => $ post ->id , 'tag_id ' => 400 , 'flag ' => '' ],
808
+ ['post_id ' => $ post ->id , 'tag_id ' => 1 , 'flag ' => '' ],
809
+ ['post_id ' => $ post ->id , 'tag_id ' => 2 , 'flag ' => 'exclude ' ],
810
+ ['post_id ' => $ post ->id , 'tag_id ' => 3 , 'flag ' => '' ],
808
811
]);
809
812
810
- $ this ->assertEquals ([200 , 400 ], $ post ->tags ()->allRelatedIds ()->toArray ());
813
+ $ this ->assertEquals ([1 , 3 ], $ post ->tags ()->allRelatedIds ()->toArray ());
811
814
}
812
815
813
- /** @group SkipMSSQL */
814
816
public function testCanTouchRelatedModels ()
815
817
{
816
818
$ post = Post::create (['title ' => Str::random ()]);
817
819
818
820
DB ::table ('tags ' )->insert ([
819
- ['id ' => 200 , ' name ' => Str::random ()],
820
- ['id ' => 300 , ' name ' => Str::random ()],
821
+ ['name ' => Str::random ()],
822
+ ['name ' => Str::random ()],
821
823
]);
822
824
823
825
DB ::table ('posts_tags ' )->insert ([
824
- ['post_id ' => $ post ->id , 'tag_id ' => 200 , 'flag ' => '' ],
825
- ['post_id ' => $ post ->id , 'tag_id ' => 300 , 'flag ' => 'exclude ' ],
826
- ['post_id ' => $ post ->id , 'tag_id ' => 400 , 'flag ' => '' ],
826
+ ['post_id ' => $ post ->id , 'tag_id ' => 1 , 'flag ' => '' ],
827
+ ['post_id ' => $ post ->id , 'tag_id ' => 2 , 'flag ' => 'exclude ' ],
828
+ ['post_id ' => $ post ->id , 'tag_id ' => 3 , 'flag ' => '' ],
827
829
]);
828
830
829
831
Carbon::setTestNow ('2017-10-10 10:10:10 ' );
830
832
831
833
$ post ->tags ()->touch ();
832
834
833
835
foreach ($ post ->tags ()->pluck ('tags.updated_at ' ) as $ date ) {
834
- $ this ->assertSame ('2017-10-10 10:10:10 ' , $ date );
836
+ if ($ this ->driver === 'sqlsrv ' ) {
837
+ $ this ->assertSame ('2017-10-10 10:10:10.000 ' , $ date );
838
+ } else {
839
+ $ this ->assertSame ('2017-10-10 10:10:10 ' , $ date );
840
+ }
835
841
}
836
842
837
- $ this ->assertNotSame ('2017-10-10 10:10:10 ' , Tag::find (300 )->updated_at );
843
+ $ this ->assertNotSame ('2017-10-10 10:10:10 ' , Tag::find (2 )->updated_at );
838
844
}
839
845
840
- /** @group SkipMSSQL */
841
846
public function testWherePivotOnString ()
842
847
{
843
848
$ tag = Tag::create (['name ' => Str::random ()])->fresh ();
@@ -854,7 +859,6 @@ public function testWherePivotOnString()
854
859
$ this ->assertEquals ($ relationTag ->getAttributes (), $ tag ->getAttributes ());
855
860
}
856
861
857
- /** @group SkipMSSQL */
858
862
public function testFirstWhere ()
859
863
{
860
864
$ tag = Tag::create (['name ' => 'foo ' ])->fresh ();
@@ -871,7 +875,6 @@ public function testFirstWhere()
871
875
$ this ->assertEquals ($ relationTag ->getAttributes (), $ tag ->getAttributes ());
872
876
}
873
877
874
- /** @group SkipMSSQL */
875
878
public function testWherePivotOnBoolean ()
876
879
{
877
880
$ tag = Tag::create (['name ' => Str::random ()])->fresh ();
@@ -888,7 +891,6 @@ public function testWherePivotOnBoolean()
888
891
$ this ->assertEquals ($ relationTag ->getAttributes (), $ tag ->getAttributes ());
889
892
}
890
893
891
- /** @group SkipMSSQL */
892
894
public function testWherePivotInMethod ()
893
895
{
894
896
$ tag = Tag::create (['name ' => Str::random ()])->fresh ();
@@ -923,7 +925,6 @@ public function testOrWherePivotInMethod()
923
925
$ this ->assertEquals ($ relationTags ->pluck ('id ' )->toArray (), [$ tag1 ->id , $ tag3 ->id ]);
924
926
}
925
927
926
- /** @group SkipMSSQL */
927
928
public function testWherePivotNotInMethod ()
928
929
{
929
930
$ tag1 = Tag::create (['name ' => Str::random ()]);
@@ -962,7 +963,6 @@ public function testOrWherePivotNotInMethod()
962
963
$ this ->assertEquals ($ relationTags ->pluck ('id ' )->toArray (), [$ tag1 ->id , $ tag2 ->id ]);
963
964
}
964
965
965
- /** @group SkipMSSQL */
966
966
public function testWherePivotNullMethod ()
967
967
{
968
968
$ tag1 = Tag::create (['name ' => Str::random ()]);
@@ -980,7 +980,6 @@ public function testWherePivotNullMethod()
980
980
$ this ->assertEquals ($ relationTag ->getAttributes (), $ tag2 ->getAttributes ());
981
981
}
982
982
983
- /** @group SkipMSSQL */
984
983
public function testWherePivotNotNullMethod ()
985
984
{
986
985
$ tag1 = Tag::create (['name ' => Str::random ()])->fresh ();
@@ -1105,7 +1104,6 @@ public function testPivotDoesntHavePrimaryKey()
1105
1104
$ this ->assertEquals (0 , $ user ->postsWithCustomPivot ()->first ()->pivot ->is_draft );
1106
1105
}
1107
1106
1108
- /** @group SkipMSSQL */
1109
1107
public function testOrderByPivotMethod ()
1110
1108
{
1111
1109
$ tag1 = Tag::create (['name ' => Str::random ()]);
0 commit comments