57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Models\Documento;
|
|
use Tests\TestCase;
|
|
|
|
class DocumentoLinkTest extends TestCase
|
|
{
|
|
public function test_is_link_returns_true_when_tipo_is_link(): void
|
|
{
|
|
$doc = new Documento(['tipo' => 'link']);
|
|
$this->assertTrue($doc->isLink());
|
|
}
|
|
|
|
public function test_is_link_returns_false_when_tipo_is_upload(): void
|
|
{
|
|
$doc = new Documento(['tipo' => 'upload']);
|
|
$this->assertFalse($doc->isLink());
|
|
}
|
|
|
|
public function test_is_link_returns_false_when_tipo_is_allegato(): void
|
|
{
|
|
$doc = new Documento(['tipo' => 'allegato']);
|
|
$this->assertFalse($doc->isLink());
|
|
}
|
|
|
|
public function test_is_link_returns_false_when_tipo_is_null(): void
|
|
{
|
|
$doc = new Documento();
|
|
$this->assertFalse($doc->isLink());
|
|
}
|
|
|
|
public function test_url_is_fillable(): void
|
|
{
|
|
$doc = new Documento(['url' => 'https://example.com/doc']);
|
|
$this->assertEquals('https://example.com/doc', $doc->url);
|
|
}
|
|
|
|
public function test_link_doc_has_no_file_fields(): void
|
|
{
|
|
$doc = new Documento([
|
|
'tipo' => 'link',
|
|
'url' => 'https://example.com/doc',
|
|
'file_path' => null,
|
|
'mime_type' => null,
|
|
'dimensione' => null,
|
|
]);
|
|
$this->assertNull($doc->file_path);
|
|
$this->assertNull($doc->mime_type);
|
|
$this->assertNull($doc->dimensione);
|
|
$this->assertTrue($doc->isLink());
|
|
}
|
|
}
|