mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
* ✨ Set properties from model functions returning an Attribute * ✅ Add test for model Attributes * 🎨 Fix code style * 🔖 Update changelog * ✅ Update test to not require php 8 * 🐛 Fix PHP 7.3 incompatibility * ✅ Update tests to only run when Illuminate Attribute exists
34 lines
929 B
PHP
34 lines
929 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Attributes;
|
|
|
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
|
|
|
class Test extends AbstractModelsCommand
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
if (!class_exists('\Illuminate\Database\Eloquent\Casts\Attribute')) {
|
|
$this->markTestSkipped('This test requires Laravel 8.77 or newer');
|
|
}
|
|
}
|
|
|
|
public function test(): void
|
|
{
|
|
$command = $this->app->make(ModelsCommand::class);
|
|
|
|
$tester = $this->runCommand($command, [
|
|
'--write' => true,
|
|
]);
|
|
|
|
$this->assertSame(0, $tester->getStatusCode());
|
|
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
|
$this->assertMatchesMockedSnapshot();
|
|
}
|
|
}
|