/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Generators/CastMakeCommandTest.php
37 строк
1 KB
Mior Muhammad Zaki
[10.x] Test Improvements (#48378)
13 сен 2023, 17:32
Не верифицирован
13 сен 2023, 17:32
33a206e
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Generators; class CastMakeCommandTest extends TestCase { protected $files = [ 'app/Casts/Foo.php', ]; public function testItCanGenerateCastFile() { $this->artisan('make:cast', ['name' => 'Foo']) ->assertExitCode(0); $this->assertFileContains([ 'namespace App\Casts;', 'use Illuminate\Contracts\Database\Eloquent\CastsAttributes;', 'class Foo implements CastsAttributes', 'public function get(Model $model, string $key, mixed $value, array $attributes): mixed', 'public function set(Model $model, string $key, mixed $value, array $attributes): mixed', ], 'app/Casts/Foo.php'); } public function testItCanGenerateInboundCastFile() { $this->artisan('make:cast', ['name' => 'Foo', '--inbound' => true]) ->assertExitCode(0); $this->assertFileContains([ 'namespace App\Casts;', 'use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;', 'class Foo implements CastsInboundAttributes', 'public function set(Model $model, string $key, mixed $value, array $attributes): mixed', ], 'app/Casts/Foo.php'); } }