@@ -155,6 +155,8 @@ protected function createSchema()
155155 */
156156 protected function tearDown (): void
157157 {
158+ parent ::tearDown ();
159+
158160 foreach (['default ' , 'second_connection ' ] as $ connection ) {
159161 $ this ->schema ($ connection )->drop ('users ' );
160162 $ this ->schema ($ connection )->drop ('friends ' );
@@ -165,6 +167,8 @@ protected function tearDown(): void
165167
166168 Relation::morphMap ([], false );
167169 Eloquent::unsetConnectionResolver ();
170+
171+ Carbon::setTestNow (null );
168172 }
169173
170174 /**
@@ -1627,8 +1631,6 @@ public function testUpdatingChildModelTouchesParent()
16271631
16281632 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps. ' );
16291633 $ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1630-
1631- Carbon::setTestNow ($ before );
16321634 }
16331635
16341636 public function testMultiLevelTouchingWorks ()
@@ -1647,8 +1649,6 @@ public function testMultiLevelTouchingWorks()
16471649
16481650 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
16491651 $ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1650-
1651- Carbon::setTestNow ($ before );
16521652 }
16531653
16541654 public function testDeletingChildModelTouchesParentTimestamps ()
@@ -1666,8 +1666,6 @@ public function testDeletingChildModelTouchesParentTimestamps()
16661666 $ post ->delete ();
16671667
16681668 $ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1669-
1670- Carbon::setTestNow ($ before );
16711669 }
16721670
16731671 public function testTouchingChildModelUpdatesParentsTimestamps ()
@@ -1686,8 +1684,6 @@ public function testTouchingChildModelUpdatesParentsTimestamps()
16861684
16871685 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps. ' );
16881686 $ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1689-
1690- Carbon::setTestNow ($ before );
16911687 }
16921688
16931689 public function testTouchingChildModelRespectsParentNoTouching ()
@@ -1715,8 +1711,6 @@ public function testTouchingChildModelRespectsParentNoTouching()
17151711 $ before ->isSameDay ($ user ->fresh ()->updated_at ),
17161712 'It is touching model own timestamps in withoutTouching scope, when it should not. '
17171713 );
1718-
1719- Carbon::setTestNow ($ before );
17201714 }
17211715
17221716 public function testUpdatingChildPostRespectsNoTouchingDefinition ()
@@ -1737,8 +1731,6 @@ public function testUpdatingChildPostRespectsNoTouchingDefinition()
17371731
17381732 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps when it should. ' );
17391733 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models relationships when it should be disabled. ' );
1740-
1741- Carbon::setTestNow ($ before );
17421734 }
17431735
17441736 public function testUpdatingModelInTheDisabledScopeTouchesItsOwnTimestamps ()
@@ -1759,8 +1751,6 @@ public function testUpdatingModelInTheDisabledScopeTouchesItsOwnTimestamps()
17591751
17601752 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
17611753 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1762-
1763- Carbon::setTestNow ($ before );
17641754 }
17651755
17661756 public function testDeletingChildModelRespectsTheNoTouchingRule ()
@@ -1780,8 +1770,6 @@ public function testDeletingChildModelRespectsTheNoTouchingRule()
17801770 });
17811771
17821772 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1783-
1784- Carbon::setTestNow ($ before );
17851773 }
17861774
17871775 public function testRespectedMultiLevelTouchingChain ()
@@ -1802,8 +1790,6 @@ public function testRespectedMultiLevelTouchingChain()
18021790
18031791 $ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
18041792 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1805-
1806- Carbon::setTestNow ($ before );
18071793 }
18081794
18091795 public function testTouchesGreatParentEvenWhenParentIsInNoTouchScope ()
@@ -1824,8 +1810,6 @@ public function testTouchesGreatParentEvenWhenParentIsInNoTouchScope()
18241810
18251811 $ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
18261812 $ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1827-
1828- Carbon::setTestNow ($ before );
18291813 }
18301814
18311815 public function testCanNestCallsOfNoTouching ()
@@ -1848,8 +1832,6 @@ public function testCanNestCallsOfNoTouching()
18481832
18491833 $ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
18501834 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1851-
1852- Carbon::setTestNow ($ before );
18531835 }
18541836
18551837 public function testCanPassArrayOfModelsToIgnore ()
@@ -1870,8 +1852,6 @@ public function testCanPassArrayOfModelsToIgnore()
18701852
18711853 $ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
18721854 $ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1873-
1874- Carbon::setTestNow ($ before );
18751855 }
18761856
18771857 public function testWhenBaseModelIsIgnoredAllChildModelsAreIgnored ()
0 commit comments