diff --git a/composer.json b/composer.json index 4290fab3..f188dd4f 100644 --- a/composer.json +++ b/composer.json @@ -70,7 +70,7 @@ "phpstan-baseline": "phpstan analyse --memory-limit=512M --generate-baseline", "lint": "php-cs-fixer fix --diff --dry-run", "fix-style": "php-cs-fixer fix", - "tests": "phpunit" + "tests": "LOG_DEPRECATIONS_CHANNEL=errorlog phpunit" }, "extra": { "branch-alias": { diff --git a/tests/Support/database/factories/CommentFactory.php b/tests/Support/database/factories/CommentFactory.php index bb2a336f..064cc6ec 100644 --- a/tests/Support/database/factories/CommentFactory.php +++ b/tests/Support/database/factories/CommentFactory.php @@ -16,8 +16,8 @@ class CommentFactory extends Factory public function definition(): array { return [ - 'title' => fake()->title, - 'body' => fake()->sentence, + 'title' => fake()->title(), + 'body' => fake()->sentence(), ]; } } diff --git a/tests/Support/database/factories/PostFactory.php b/tests/Support/database/factories/PostFactory.php index 4683c1e9..32881304 100644 --- a/tests/Support/database/factories/PostFactory.php +++ b/tests/Support/database/factories/PostFactory.php @@ -16,8 +16,8 @@ class PostFactory extends Factory public function definition(): array { return [ - 'title' => fake()->title, - 'body' => fake()->sentence, + 'title' => fake()->title(), + 'body' => fake()->sentence(), ]; } } diff --git a/tests/Support/database/factories/UserFactory.php b/tests/Support/database/factories/UserFactory.php index a2392ed4..8eee3664 100644 --- a/tests/Support/database/factories/UserFactory.php +++ b/tests/Support/database/factories/UserFactory.php @@ -16,7 +16,7 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name, + 'name' => fake()->name(), ]; } } diff --git a/tests/TestCase.php b/tests/TestCase.php index afecd991..881b9253 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -71,6 +71,17 @@ protected function getEnvironmentSetUp($app): void ]); $app['config']->set('app.debug', true); + + $deprecationChannel = $app['config']->get('logging.deprecations.channel'); + + if ($deprecationChannel) { + // By setting `logging.channels.deprecations` here manually we + // override some behaviour in `\Orchestra\Testbench\Bootstrap\HandleExceptions::ensureDeprecationLoggerIsConfigured` + // and avoid enabling the stacktrace + $app['config']->set('logging.channels.deprecations', [ + 'driver' => $deprecationChannel, + ]); + } } protected function assertGraphQLSchema($schema): void