-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # src/Illuminate/Foundation/Application.php # src/Illuminate/Support/Facades/DB.php # src/Illuminate/View/Engines/CompilerEngine.php
- Loading branch information
Showing
14 changed files
with
152 additions
and
17 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
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
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,41 @@ | ||
<?php | ||
|
||
namespace Illuminate\View; | ||
|
||
use ErrorException; | ||
use Illuminate\Container\Container; | ||
use Illuminate\Support\Reflector; | ||
|
||
class ViewException extends ErrorException | ||
{ | ||
/** | ||
* Report the exception. | ||
* | ||
* @return bool|null | ||
*/ | ||
public function report() | ||
{ | ||
$exception = $this->getPrevious(); | ||
|
||
if (Reflector::isCallable($reportCallable = [$exception, 'report'])) { | ||
return Container::getInstance()->call($reportCallable); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* Render the exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request) | ||
{ | ||
$exception = $this->getPrevious(); | ||
|
||
if ($exception && method_exists($exception, 'render')) { | ||
return $exception->render($request); | ||
} | ||
} | ||
} |
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 | ||
|
||
namespace Illuminate\Tests\Integration\View; | ||
|
||
use Exception; | ||
use Illuminate\Http\Response; | ||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Support\Facades\View; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
class RenderableViewExceptionTest extends TestCase | ||
{ | ||
public function testRenderMethodOfExceptionThrownInViewGetsHandled() | ||
{ | ||
Route::get('/', function () { | ||
return View::make('renderable-exception'); | ||
}); | ||
|
||
$response = $this->get('/'); | ||
|
||
$response->assertSee('This is a renderable exception.'); | ||
} | ||
|
||
protected function getEnvironmentSetUp($app) | ||
{ | ||
$app['config']->set('view.paths', [__DIR__.'/templates']); | ||
} | ||
} | ||
|
||
class RenderableException extends Exception | ||
{ | ||
public function render($request) | ||
{ | ||
return new Response('This is a renderable exception.'); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/Integration/View/templates/renderable-exception.blade.php
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,3 @@ | ||
@php | ||
throw new Illuminate\Tests\Integration\View\RenderableException; | ||
@endphp |
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 |
---|---|---|
@@ -1 +0,0 @@ | ||
Hello World | ||