Skip to content

Commit 31b0fdf

Browse files
committed
Drop test collections correctly
Drop test collections correctly
1 parent a73a667 commit 31b0fdf

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/DatabaseEloquentTimestampsTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class DatabaseEloquentTimestampsTest extends TestCase
1414
*/
1515
protected function tearDown(): void
1616
{
17-
User::truncate();
17+
$this->schema()->drop('users');
18+
$this->schema()->drop('users_created_at');
19+
$this->schema()->drop('users_updated_at');
1820
}
1921

2022
/**
@@ -50,6 +52,26 @@ public function testUserWithUpdatedAt()
5052

5153
$this->assertEquals($now->toDateTimeString(), $user->updated_at->toDateTimeString());
5254
}
55+
56+
/**
57+
* Get a database connection instance.
58+
*
59+
* @return \Illuminate\Database\ConnectionInterface
60+
*/
61+
protected function connection()
62+
{
63+
return Eloquent::getConnectionResolver()->connection();
64+
}
65+
66+
/**
67+
* Get a schema builder instance.
68+
*
69+
* @return \Illuminate\Database\Schema\Builder
70+
*/
71+
protected function schema()
72+
{
73+
return $this->connection()->getSchemaBuilder();
74+
}
5375
}
5476

5577
/**

0 commit comments

Comments
 (0)