Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DataCollector/ViewCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function addView(View $view)
];

if ($this->getXdebugLink($path)) {
$template['xdebug_link'] = $this->getXdebugLink($path);
$template['xdebug_link'] = $this->getXdebugLink(realpath($view->getPath()));
}

$this->templates[] = $template;
Expand Down
30 changes: 30 additions & 0 deletions tests/DataCollector/ViewCollectorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Barryvdh\Debugbar\Tests\DataCollector;

use Barryvdh\Debugbar\Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;

class ViewCollectorTest extends TestCase
{
use RefreshDatabase;

public function testIdeLinksAreAbsolutePaths()
{
debugbar()->boot();

/** @var \Barryvdh\Debugbar\DataCollector\ViewCollector $collector */
$collector = debugbar()->getCollector('views');
$collector->addView(
view('dashboard')
);

tap(Arr::first($collector->collect()['templates']), function (array $template) {
$this->assertEquals(
'vscode://file/'.realpath(__DIR__.'/../resources/views/dashboard.blade.php').':1',
$template['xdebug_link']['url'],
);
});
}
}
6 changes: 6 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected function getEnvironmentSetUp($app)

$this->addWebRoutes($router);
$this->addApiRoutes($router);
$this->addViewPaths();
}

/**
Expand Down Expand Up @@ -79,4 +80,9 @@ protected function addApiRoutes(Router $router)
}
]);
}

protected function addViewPaths()
{
config(['view.paths' => array_merge(config('view.paths'), [__DIR__.'/resources/views'])]);
}
}
3 changes: 3 additions & 0 deletions tests/resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<p>Basic view</p>
</div>