File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010use Laragear \Preload \Http \Middleware \PreloadMiddleware ;
1111use Laragear \Preload \Preloader ;
1212use Laragear \Preload \PreloadServiceProvider ;
13+ use function get_class ;
14+ use function method_exists ;
1315
1416class ServiceProviderTest extends TestCase
1517{
@@ -51,9 +53,13 @@ protected function usesProductionEnvironment(Application $app): void
5153 */
5254 public function test_registers_global_middleware_on_production (): void
5355 {
54- static ::assertTrue (
55- $ this ->app ->make (Kernel::class)->hasMiddleware (PreloadMiddleware::class)
56- );
56+ $ http = $ this ->app ->make (Kernel::class);
57+
58+ if (!method_exists ($ http , 'pushMiddleware ' )) {
59+ $ this ->markTestSkipped ('The ' . get_class ($ http ) . ' does not have a pushMiddleware() method to test. ' );
60+ }
61+
62+ static ::assertTrue ($ http ->hasMiddleware (PreloadMiddleware::class));
5763 }
5864
5965 protected function setConfigEnableTrue (Application $ app ): void
@@ -66,9 +72,13 @@ protected function setConfigEnableTrue(Application $app): void
6672 */
6773 public function test_registers_global_middleware_when_config_is_true (): void
6874 {
69- static ::assertTrue (
70- app (Kernel::class)->hasMiddleware (PreloadMiddleware::class)
71- );
75+ $ http = $ this ->app ->make (Kernel::class);
76+
77+ if (!method_exists ($ http , 'pushMiddleware ' )) {
78+ $ this ->markTestSkipped ('The ' . get_class ($ http ) . ' does not have a pushMiddleware() method to test. ' );
79+ }
80+
81+ static ::assertTrue ($ http ->hasMiddleware (PreloadMiddleware::class));
7282 }
7383
7484 public function test_registers_command (): void
You can’t perform that action at this time.
0 commit comments