Skip to content

Commit 051173c

Browse files
committed
Split exception handling methods
1 parent 471bf6c commit 051173c

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed

src/Codeception/Module/Laravel.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Codeception\Module\Laravel\InteractsWithContainer;
1717
use Codeception\Module\Laravel\InteractsWithEloquent;
1818
use Codeception\Module\Laravel\InteractsWithEvents;
19+
use Codeception\Module\Laravel\InteractsWithExceptionHandling;
1920
use Codeception\Subscriber\ErrorHandler;
2021
use Codeception\TestInterface;
2122
use Codeception\Util\ReflectionHelper;
@@ -132,6 +133,7 @@ class Laravel extends Framework implements ActiveRecord, PartedModule
132133
use InteractsWithContainer;
133134
use InteractsWithEloquent;
134135
use InteractsWithEvents;
136+
use InteractsWithExceptionHandling;
135137

136138
/**
137139
* @var Application
@@ -293,32 +295,6 @@ protected function revertErrorHandler(): void
293295
set_error_handler([$handler, 'errorHandler']);
294296
}
295297

296-
/**
297-
* Enable Laravel exception handling.
298-
*
299-
* ```php
300-
* <?php
301-
* $I->enableExceptionHandling();
302-
* ```
303-
*/
304-
public function enableExceptionHandling()
305-
{
306-
$this->client->enableExceptionHandling();
307-
}
308-
309-
/**
310-
* Disable Laravel exception handling.
311-
*
312-
* ```php
313-
* <?php
314-
* $I->disableExceptionHandling();
315-
* ```
316-
*/
317-
public function disableExceptionHandling()
318-
{
319-
$this->client->disableExceptionHandling();
320-
}
321-
322298
/**
323299
* Disable middleware for the next requests.
324300
*
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Codeception\Module\Laravel;
6+
7+
trait InteractsWithExceptionHandling
8+
{
9+
/**
10+
* Disable Laravel exception handling.
11+
*
12+
* ```php
13+
* <?php
14+
* $I->disableExceptionHandling();
15+
* ```
16+
*/
17+
public function disableExceptionHandling()
18+
{
19+
$this->client->disableExceptionHandling();
20+
}
21+
22+
/**
23+
* Enable Laravel exception handling.
24+
*
25+
* ```php
26+
* <?php
27+
* $I->enableExceptionHandling();
28+
* ```
29+
*/
30+
public function enableExceptionHandling()
31+
{
32+
$this->client->enableExceptionHandling();
33+
}
34+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy