/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Console/Tests/Exception/RunCommandFailedExceptionTest.php
49 строк
1 KB
Robin Chalas
[7.4] Remove usages of named arguments in tests
22 апр 2026, 18:21
Не верифицирован
22 апр 2026, 18:21
2b0e324
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Exception; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\RunCommandFailedException; use Symfony\Component\Console\Messenger\RunCommandContext; use Symfony\Component\Console\Messenger\RunCommandMessage; class RunCommandFailedExceptionTest extends TestCase { public function testDefaultExceptionProvidesCode() { $exception = self::createException(new \Exception('Boom!', 42)); self::assertSame(42, $exception->getCode()); } public function testNonIntegerCodeProvidesZero() { $exception = self::createException(new class extends \Exception { protected $code = 'non-integer-code'; }); self::assertSame(0, $exception->getCode()); } private static function createException(\Throwable $inner): RunCommandFailedException { return new RunCommandFailedException( $inner, new RunCommandContext( new RunCommandMessage('foo'), Command::FAILURE, 'bar' ) ); } }