Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit 4e87387

Browse files
committed
Merge branch 'master' of github.com:beyondcode/laravel-xray
2 parents 14097e6 + dde2601 commit 4e87387

File tree

6 files changed

+665
-3
lines changed

6 files changed

+665
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ If you discover any security related issues, please email marcel@beyondco.de ins
106106

107107
This project is inspired by [xray-rails](https://github.com/brentd/xray-rails).
108108

109-
- [Marcel Pociot](https://github.com/:author_username)
109+
- [Marcel Pociot](https://github.com/mpociot)
110110
- [All Contributors](../../contributors)
111111

112112
## License

src/Xray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function modifyView($view)
3434

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

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

63-
}
63+
}

tests/XrayTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ public function it_does_not_apply_middleware_on_json_responses()
3434

3535
$this->get('/')->assertJson($data);
3636
}
37+
38+
/** @test */
39+
public function it_adds_xray_when_using_parenthesis_on_sections()
40+
{
41+
Route::get('/', function() {
42+
return view('example2');
43+
});
44+
45+
$response = $this->get('/');
46+
47+
$this->assertMatchesSnapshot($response->getContent());
48+
}
3749
}

0 commit comments

Comments
 (0)