-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2723c89
commit daaf728
Showing
13 changed files
with
203 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,5 @@ coverage | |
docs | ||
phpunit.xml | ||
phpstan.neon | ||
testbench.yaml | ||
vendor | ||
node_modules |
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
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,2 @@ | ||
providers: | ||
- Workbench\App\Providers\FolioServiceProvider |
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,53 @@ | ||
<?php | ||
|
||
use Laravel\Folio\Folio; | ||
|
||
it('can get', function () { | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->get('/methods'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('get'); | ||
}); | ||
|
||
it('can post', function () { | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->post('/methods'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('post'); | ||
}); | ||
|
||
it('can put', function () { | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->put('/methods'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('put'); | ||
}); | ||
|
||
it('can patch', function () { | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->patch('/methods'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('patch'); | ||
}); | ||
|
||
it('can delete', function () { | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->delete('/methods'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('delete'); | ||
}); |
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,36 @@ | ||
<?php | ||
|
||
use Laravel\Folio\Folio; | ||
|
||
test('there will be none', function () { | ||
$this->withoutExceptionHandling(); | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->get('/wildcards'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('0'); | ||
}); | ||
|
||
test('there will be one', function () { | ||
$this->withoutExceptionHandling(); | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->get('/wildcards/1'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('1'); | ||
}); | ||
|
||
test('there will be two', function () { | ||
$this->withoutExceptionHandling(); | ||
Folio::route(__DIR__.'/resources/views/pages'); | ||
|
||
$response = $this->get('/wildcards/1/2'); | ||
|
||
$response->assertStatus(200); | ||
|
||
$response->assertSee('2'); | ||
}); |
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,23 @@ | ||
|
||
@switch(request()->method()) | ||
@case('GET') | ||
<h1>get</h1> | ||
@break | ||
@case('POST') | ||
<h1>post</h1> | ||
@break | ||
@case('PUT') | ||
<h1>put</h1> | ||
@break | ||
@case('PATCH') | ||
<h1>patch</h1> | ||
@break | ||
@case('DELETE') | ||
<h1>delete</h1> | ||
@break | ||
@default | ||
@php | ||
throw new Exception('This should never happen'); | ||
@endphp | ||
@endswitch | ||
|
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,2 @@ | ||
|
||
{{ count($ids) }} |
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,35 @@ | ||
<?php | ||
|
||
namespace Workbench\App\Providers; | ||
|
||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Support\Facades\View; | ||
use Illuminate\Support\ServiceProvider; | ||
use Laravel\Folio\Folio; | ||
|
||
class FolioServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register services. | ||
*/ | ||
public function register(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Bootstrap services. | ||
*/ | ||
public function boot(): void | ||
{ | ||
Route::view('/', 'welcome'); | ||
|
||
View::addLocation(__DIR__.'/../../../tests/resources/views'); | ||
|
||
Folio::path(__DIR__.'/../../../tests/resources/views/pages')->middleware([ | ||
'*' => [ | ||
// | ||
], | ||
]); | ||
} | ||
} |