Created
May 25, 2023 09:11
-
-
Save DominikStyp/233768b37647b69e625c7f2b80d6cda2 to your computer and use it in GitHub Desktop.
Laravel: how to check if view blade syntax is correct and section tags are properly closed (PHPUnit)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BladeViewCorrectSyntaxTest { | |
/** | |
* @see https://stackoverflow.com/questions/38400305/phpunit-help-needed-about-risky-tests | |
*/ | |
public function view_test() | |
{ | |
$viewName = 'some.view'; | |
view($viewName)->render(); | |
$this->assertEquals( | |
1, | |
ob_get_level(), | |
"$viewName didn't close the output buffering, please check if the view blade sections are closed properly like @section @endsection etc." | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment