1 | <?php |
||
2 | |||
3 | namespace MaksimM\ConditionalDebugBar\Tests; |
||
4 | |||
5 | use Barryvdh\Debugbar\ServiceProvider; |
||
6 | use MaksimM\ConditionalDebugBar\ConditionalDebugBarServiceProvider; |
||
7 | use MaksimM\ConditionalDebugBar\DebugModeBootValidators\TestingDebugBarBootValidator; |
||
8 | use MaksimM\ConditionalDebugBar\Http\Middleware\OptionalDebugBar; |
||
9 | use Orchestra\Testbench\BrowserKit\TestCase; |
||
10 | |||
11 | class BootedAlreadyEnabledDebugBarRouteTest extends TestCase |
||
12 | { |
||
13 | private $blank_page = '<html xmlns="http://www.w3.org/1999/html"><head></head><body</body</html>'; |
||
14 | |||
15 | /** @test */ |
||
16 | public function validateAssets() |
||
17 | { |
||
18 | $this->validatePage(); |
||
19 | $crawler = $this->call('GET', route('debugbar.assets.js')); |
||
20 | $this->assertEquals(200, $crawler->getStatusCode()); |
||
21 | $crawler = $this->call('GET', route('debugbar.assets.css')); |
||
22 | $this->assertEquals(200, $crawler->getStatusCode()); |
||
23 | } |
||
24 | |||
25 | /** @test */ |
||
26 | public function validatePage() |
||
27 | { |
||
28 | $crawler = $this->call('GET', 'page-with-middleware'); |
||
29 | $this->assertNotEquals($this->blank_page, $crawler->getContent()); |
||
30 | $this->assertContains('PhpDebugBar.DebugBar', $crawler->getContent()); |
||
31 | } |
||
32 | |||
33 | protected function getPackageProviders($app) |
||
0 ignored issues
–
show
|
|||
34 | { |
||
35 | return [ServiceProvider::class, ConditionalDebugBarServiceProvider::class]; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Define environment setup. |
||
40 | * |
||
41 | * @param Illuminate\Foundation\Application $app |
||
0 ignored issues
–
show
|
|||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | protected function getEnvironmentSetUp($app) |
||
46 | { |
||
47 | $app['config']->set('conditional-debugbar.debugbar-boot-validator', TestingDebugBarBootValidator::class); |
||
48 | $app['config']->set('debugbar.enabled', true); |
||
49 | $app['config']->set('app.debug', true); |
||
50 | resolve(\Barryvdh\Debugbar\LaravelDebugbar::class)->enable(); |
||
51 | $app['router']->get('page-with-middleware', ['uses' => function () { |
||
52 | return $this->blank_page; |
||
53 | }])->middleware(OptionalDebugBar::class); |
||
54 | } |
||
55 | } |
||
56 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.