33namespace Yajra \DataTables \Exports \Tests ;
44
55use Illuminate \Database \Schema \Blueprint ;
6+ use Illuminate \Support \Facades \DB ;
67use Illuminate \Support \Facades \View ;
78use Illuminate \Testing \TestResponse ;
89use Orchestra \Testbench \TestCase as BaseTestCase ;
10+ use Yajra \DataTables \Exports \Tests \DataTables \UsersDataTable ;
911use Yajra \DataTables \Exports \Tests \Models \User ;
1012
1113abstract class TestCase extends BaseTestCase
@@ -29,10 +31,16 @@ protected function setUp(): void
2931 $ this ->seedDatabase ();
3032 }
3133
34+ protected function defineRoutes ($ router ): void
35+ {
36+ $ router ->get ('/users ' , function (UsersDataTable $ dataTable ) {
37+ return $ dataTable ->render ('tests::users ' );
38+ });
39+ }
40+
3241 protected function migrateDatabase (): void
3342 {
34- /** @var \Illuminate\Database\Schema\Builder $schemaBuilder */
35- $ schemaBuilder = $ this ->app ['db ' ]->connection ()->getSchemaBuilder ();
43+ $ schemaBuilder = DB ::getSchemaBuilder ();
3644 if (! $ schemaBuilder ->hasTable ('users ' )) {
3745 $ schemaBuilder ->create ('users ' , function (Blueprint $ table ) {
3846 $ table ->increments ('id ' );
@@ -83,7 +91,7 @@ protected function seedDatabase(): void
8391 *
8492 * @param \Illuminate\Foundation\Application $app
8593 */
86- protected function getEnvironmentSetUp ($ app )
94+ protected function getEnvironmentSetUp ($ app ): void
8795 {
8896 $ app ['config ' ]->set ('app.debug ' , true );
8997 $ app ['config ' ]->set ('queue.default ' , 'sync ' );
0 commit comments