/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Testing/Console/ConfigShowCommandTest.php
75 строк
3 KB
Francisco Madeira
[10.x] Add `config:show` command (#47858)
28 июл 2023, 21:11
Не верифицирован
28 июл 2023, 21:11
4fbf481
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Testing\Console; use Illuminate\Foundation\Console\ConfigShowCommand; use Orchestra\Testbench\TestCase; class ConfigShowCommandTest extends TestCase { protected function setUp(): void { parent::setUp(); putenv('COLUMNS=64'); } public function testDisplayConfig() { config()->set('test', [ 'string' => 'Test', 'int' => 1, 'float' => 1.2, 'boolean' => true, 'null' => null, 'array' => [ ConfigShowCommand::class, ], 'empty_array' => [], 'assoc_array' => ['foo' => 'bar'], 'class' => new \stdClass, ]); $this->artisan(ConfigShowCommand::class, ['config' => 'test']) ->assertSuccessful() ->expectsOutput(' test ....................................................... ') ->expectsOutput(' string ................................................ Test ') ->expectsOutput(' int ...................................................... 1 ') ->expectsOutput(' float .................................................. 1.2 ') ->expectsOutput(' boolean ............................................... true ') ->expectsOutput(' null .................................................. null ') ->expectsOutput(' array ⇁ 0 .. Illuminate\Foundation\Console\ConfigShowCommand ') ->expectsOutput(' empty_array ............................................. [] ') ->expectsOutput(' assoc_array ⇁ foo ...................................... bar ') ->expectsOutput(' class ............................................. stdClass '); } public function testDisplayNestedConfigItems() { config()->set('test', [ 'nested' => [ 'foo' => 'bar', ], ]); $this->artisan(ConfigShowCommand::class, ['config' => 'test.nested']) ->assertSuccessful() ->expectsOutput(' test.nested ................................................ ') ->expectsOutput(' foo .................................................... bar '); } public function testDisplaySingleValue() { config()->set('foo', 'bar'); $this->artisan(ConfigShowCommand::class, ['config' => 'foo']) ->assertSuccessful() ->expectsOutput(' foo .................................................... bar '); } public function testDisplayErrorIfConfigDoesNotExist() { $this->artisan(ConfigShowCommand::class, ['config' => 'invalid']) ->assertFailed(); } }