/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Testing/Concerns/InteractsWithDeprecationHandlingTest.php
47 строк
1 KB
Lucas Michot
[13.x] Simplify most of the exceptions expectations (#61049)
05 авг 2026, 18:34
Не верифицирован
05 авг 2026, 18:34
910cd94
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Testing\Concerns; use ErrorException; use Illuminate\Foundation\Bootstrap\HandleExceptions; use Illuminate\Foundation\Testing\Concerns\InteractsWithDeprecationHandling; use PHPUnit\Framework\TestCase; class InteractsWithDeprecationHandlingTest extends TestCase { use InteractsWithDeprecationHandling; protected $deprecationsFound = false; protected function setUp(): void { set_error_handler(function () { $this->deprecationsFound = true; }); } protected function tearDown(): void { $this->deprecationsFound = false; HandleExceptions::flushHandlersState($this); } public function testWithDeprecationHandling() { $this->withDeprecationHandling(); trigger_error('Something is deprecated', E_USER_DEPRECATED); $this->assertTrue($this->deprecationsFound); } public function testWithoutDeprecationHandling() { $this->withoutDeprecationHandling(); $this->expectExceptionObject(new ErrorException('Something is deprecated')); trigger_error('Something is deprecated', E_USER_DEPRECATED); } }