-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return 404 if a custom script or style is not found
- Loading branch information
Showing
6 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace BinaryTorch\LaRecipe\Tests\Feature; | ||
|
||
use BinaryTorch\LaRecipe\LaRecipe; | ||
use BinaryTorch\LaRecipe\Tests\TestCase; | ||
|
||
class CustomScriptsTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function a_script_not_found_returns_404() | ||
{ | ||
$this->get('/docs/scripts/not-found') | ||
->assertNotFound(); | ||
} | ||
|
||
/** @test */ | ||
public function a_script_is_returned() | ||
{ | ||
LaRecipe::script('custom-script', __DIR__ . '/../theme/resources/js/custom.js'); | ||
|
||
$this->get('/docs/scripts/custom-script') | ||
->assertOk() | ||
->assertHeader('Content-Type', 'application/javascript') | ||
->assertSee('Custom JS'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace BinaryTorch\LaRecipe\Tests\Feature; | ||
|
||
use BinaryTorch\LaRecipe\LaRecipe; | ||
use BinaryTorch\LaRecipe\Tests\TestCase; | ||
|
||
class CustomStylesTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function a_script_not_found_returns_404() | ||
{ | ||
$this->get('/docs/styles/not-found') | ||
->assertNotFound(); | ||
} | ||
|
||
/** @test */ | ||
public function a_script_is_returned() | ||
{ | ||
LaRecipe::style('custom-style', __DIR__ . '/../theme/resources/css/custom.css'); | ||
|
||
$this->get('/docs/styles/custom-style') | ||
->assertOk() | ||
->assertHeader('Content-Type', 'text/css; charset=UTF-8') | ||
->assertSee('Custom CSS'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/** Custom CSS **/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// Custom JS |