Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.
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
4 changes: 2 additions & 2 deletions src/Xray.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function modifyView($view)

$file = tempnam(sys_get_temp_dir(), $view->name());

$re = '/(@section\(([^))]+)\))(.*?)(@endsection|@show|@overwrite)/s';
$re = '/(@section\(([^))]+)\)+)(.*?)(@endsection|@show|@overwrite)/s';
$viewContent = preg_replace_callback($re, function ($matches) use ($view) {
++$this->viewId;
$sectionName = str_replace(["'", '"'], '', $matches[2]);
Expand All @@ -60,4 +60,4 @@ protected function isEnabledForView(string $viewName): bool
return ! in_array($viewName, config('xray.excluded', []));
}

}
}
12 changes: 12 additions & 0 deletions tests/XrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,16 @@ public function it_does_not_apply_middleware_on_json_responses()

$this->get('/')->assertJson($data);
}

/** @test */
public function it_adds_xray_when_using_parenthesis_on_sections()
{
Route::get('/', function() {
return view('example2');
});

$response = $this->get('/');

$this->assertMatchesSnapshot($response->getContent());
}
}
Loading