Skip to content
Open
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
23 changes: 5 additions & 18 deletions tests/AppBootstrapBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ class AppBootstrapBuilderTest extends TestCase

public function testAddExceptionsRenderEmpty(): void
{
$file = $this->generateOriginalStructurePath('bootstrap_empty.php');

$this->mockNativeFunction(
'RonasIT\Larabuilder\Builders',
$this->callFilePutContent($file, 'bootstrap_empty.php'),
);
$file = $this->mockFileSave('bootstrap_empty.php');

new AppBootstrapBuilder($file)
->addExceptionsRender(
Expand All @@ -40,12 +35,7 @@ public function testAddExceptionsRenderEmpty(): void

public function testAddExceptionsRenderCustom(): void
{
$file = $this->generateOriginalStructurePath('bootstrap_configured.php');

$this->mockNativeFunction(
'RonasIT\Larabuilder\Builders',
$this->callFilePutContent($file, 'bootstrap_configured.php'),
);
$file = $this->mockFileSave('bootstrap_configured.php');

new AppBootstrapBuilder($file)
->addExceptionsRender(
Expand All @@ -68,12 +58,7 @@ public function testAddExceptionsRenderCustom(): void

public function testAddExceptionsRenderExist(): void
{
$file = $this->generateOriginalStructurePath('bootstrap_with_render.php');

$this->mockNativeFunction(
'RonasIT\Larabuilder\Builders',
$this->callFilePutContent($file, 'bootstrap_with_render.php'),
);
$file = $this->mockFileSave('bootstrap_with_render.php');

new AppBootstrapBuilder($file)
->addExceptionsRender(
Expand All @@ -88,6 +73,7 @@ public function testAddExceptionsRenderInvalidBody()
{
$file = $this->generateOriginalStructurePath('bootstrap_configured.php');

$this->expectNoFileSave();
$this->assertExceptionThrew(
expectedClassName: InvalidPHPCodeException::class,
expectedMessage: 'Cannot parse provided code: \'return ($request->expectsJson()\'.',
Expand Down Expand Up @@ -128,6 +114,7 @@ public function testInvalidBootstrapAppFileException(string $fixture, string $ty
{
$file = $this->generateOriginalStructurePath($fixture);

$this->expectNoFileSave();
$this->assertExceptionThrew(InvalidBootstrapAppFileException::class, "Bootstrap app file must not contain {$type} declarations");

new AppBootstrapBuilder($file)
Expand Down
Loading