@@ -155,6 +155,8 @@ protected function createSchema()
155
155
*/
156
156
protected function tearDown (): void
157
157
{
158
+ parent ::tearDown ();
159
+
158
160
foreach (['default ' , 'second_connection ' ] as $ connection ) {
159
161
$ this ->schema ($ connection )->drop ('users ' );
160
162
$ this ->schema ($ connection )->drop ('friends ' );
@@ -165,6 +167,8 @@ protected function tearDown(): void
165
167
166
168
Relation::morphMap ([], false );
167
169
Eloquent::unsetConnectionResolver ();
170
+
171
+ Carbon::setTestNow (null );
168
172
}
169
173
170
174
/**
@@ -1627,8 +1631,6 @@ public function testUpdatingChildModelTouchesParent()
1627
1631
1628
1632
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps. ' );
1629
1633
$ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1630
-
1631
- Carbon::setTestNow ($ before );
1632
1634
}
1633
1635
1634
1636
public function testMultiLevelTouchingWorks ()
@@ -1647,8 +1649,6 @@ public function testMultiLevelTouchingWorks()
1647
1649
1648
1650
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1649
1651
$ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1650
-
1651
- Carbon::setTestNow ($ before );
1652
1652
}
1653
1653
1654
1654
public function testDeletingChildModelTouchesParentTimestamps ()
@@ -1666,8 +1666,6 @@ public function testDeletingChildModelTouchesParentTimestamps()
1666
1666
$ post ->delete ();
1667
1667
1668
1668
$ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1669
-
1670
- Carbon::setTestNow ($ before );
1671
1669
}
1672
1670
1673
1671
public function testTouchingChildModelUpdatesParentsTimestamps ()
@@ -1686,8 +1684,6 @@ public function testTouchingChildModelUpdatesParentsTimestamps()
1686
1684
1687
1685
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps. ' );
1688
1686
$ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is not touching models related timestamps. ' );
1689
-
1690
- Carbon::setTestNow ($ before );
1691
1687
}
1692
1688
1693
1689
public function testTouchingChildModelRespectsParentNoTouching ()
@@ -1715,8 +1711,6 @@ public function testTouchingChildModelRespectsParentNoTouching()
1715
1711
$ before ->isSameDay ($ user ->fresh ()->updated_at ),
1716
1712
'It is touching model own timestamps in withoutTouching scope, when it should not. '
1717
1713
);
1718
-
1719
- Carbon::setTestNow ($ before );
1720
1714
}
1721
1715
1722
1716
public function testUpdatingChildPostRespectsNoTouchingDefinition ()
@@ -1737,8 +1731,6 @@ public function testUpdatingChildPostRespectsNoTouchingDefinition()
1737
1731
1738
1732
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is not touching model own timestamps when it should. ' );
1739
1733
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models relationships when it should be disabled. ' );
1740
-
1741
- Carbon::setTestNow ($ before );
1742
1734
}
1743
1735
1744
1736
public function testUpdatingModelInTheDisabledScopeTouchesItsOwnTimestamps ()
@@ -1759,8 +1751,6 @@ public function testUpdatingModelInTheDisabledScopeTouchesItsOwnTimestamps()
1759
1751
1760
1752
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1761
1753
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1762
-
1763
- Carbon::setTestNow ($ before );
1764
1754
}
1765
1755
1766
1756
public function testDeletingChildModelRespectsTheNoTouchingRule ()
@@ -1780,8 +1770,6 @@ public function testDeletingChildModelRespectsTheNoTouchingRule()
1780
1770
});
1781
1771
1782
1772
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1783
-
1784
- Carbon::setTestNow ($ before );
1785
1773
}
1786
1774
1787
1775
public function testRespectedMultiLevelTouchingChain ()
@@ -1802,8 +1790,6 @@ public function testRespectedMultiLevelTouchingChain()
1802
1790
1803
1791
$ this ->assertTrue ($ future ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1804
1792
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1805
-
1806
- Carbon::setTestNow ($ before );
1807
1793
}
1808
1794
1809
1795
public function testTouchesGreatParentEvenWhenParentIsInNoTouchScope ()
@@ -1824,8 +1810,6 @@ public function testTouchesGreatParentEvenWhenParentIsInNoTouchScope()
1824
1810
1825
1811
$ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1826
1812
$ this ->assertTrue ($ future ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1827
-
1828
- Carbon::setTestNow ($ before );
1829
1813
}
1830
1814
1831
1815
public function testCanNestCallsOfNoTouching ()
@@ -1848,8 +1832,6 @@ public function testCanNestCallsOfNoTouching()
1848
1832
1849
1833
$ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1850
1834
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1851
-
1852
- Carbon::setTestNow ($ before );
1853
1835
}
1854
1836
1855
1837
public function testCanPassArrayOfModelsToIgnore ()
@@ -1870,8 +1852,6 @@ public function testCanPassArrayOfModelsToIgnore()
1870
1852
1871
1853
$ this ->assertTrue ($ before ->isSameDay ($ post ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1872
1854
$ this ->assertTrue ($ before ->isSameDay ($ user ->fresh ()->updated_at ), 'It is touching models when it should be disabled. ' );
1873
-
1874
- Carbon::setTestNow ($ before );
1875
1855
}
1876
1856
1877
1857
public function testWhenBaseModelIsIgnoredAllChildModelsAreIgnored ()
0 commit comments