@@ -96,8 +96,7 @@ $httpResponse = Mockery::mock(Nette\Http\IResponse::class);
9696$ httpResponse ->shouldIgnoreMissing ();
9797
9898
99- // no route without error presenter
100- Assert::exception (function () use ($ httpRequest , $ httpResponse ) {
99+ testException ('no route handling without error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
101100 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
102101 $ router = Mockery::mock (Router::class);
103102 $ router ->shouldReceive ('match ' )->andReturn (null );
@@ -107,7 +106,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) {
107106}, BadRequestException::class, 'No route for HTTP request. ' );
108107
109108
110- test ('no route with error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
109+ test ('error presenter handling for route mismatch ' , function () use ($ httpRequest , $ httpResponse ) {
111110 $ errorPresenter = new ErrorPresenter ;
112111
113112 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
@@ -133,7 +132,7 @@ test('no route with error presenter', function () use ($httpRequest, $httpRespon
133132});
134133
135134
136- test ('route to error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
135+ test ('error presenter invoked directly via router ' , function () use ($ httpRequest , $ httpResponse ) {
137136 $ errorPresenter = new ErrorPresenter ;
138137
139138 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
@@ -161,8 +160,7 @@ test('route to error presenter', function () use ($httpRequest, $httpResponse) {
161160});
162161
163162
164- // missing presenter without error presenter
165- Assert::exception (function () use ($ httpRequest , $ httpResponse ) {
163+ testException ('missing presenter exception without error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
166164 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
167165 $ presenterFactory ->shouldReceive ('createPresenter ' )->with ('Missing ' )->andThrow (Nette \Application \InvalidPresenterException::class);
168166
@@ -174,7 +172,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) {
174172}, BadRequestException::class);
175173
176174
177- test ('missing presenter with error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
175+ test ('missing presenter fallback to error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
178176 $ errorPresenter = new ErrorPresenter ;
179177
180178 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
@@ -203,8 +201,7 @@ test('missing presenter with error presenter', function () use ($httpRequest, $h
203201});
204202
205203
206- // presenter error without error presenter
207- Assert::exception (function () use ($ httpRequest , $ httpResponse ) {
204+ testException ('presenter exception propagation without error handling ' , function () use ($ httpRequest , $ httpResponse ) {
208205 $ presenterFactory = Mockery::mock (IPresenterFactory::class);
209206 $ presenterFactory ->shouldReceive ('createPresenter ' )->with ('Bad ' )->andReturn (new BadPresenter );
210207
@@ -216,7 +213,7 @@ Assert::exception(function () use ($httpRequest, $httpResponse) {
216213}, BadException::class);
217214
218215
219- test ('presenter error with error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
216+ test ('presenter exception propagation to error presenter ' , function () use ($ httpRequest , $ httpResponse ) {
220217 $ badPresenter = new BadPresenter ;
221218 $ errorPresenter = new ErrorPresenter ;
222219
0 commit comments