Page MenuHomePhorge

SharedFolderTypeTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

SharedFolderTypeTest.php

<?php
namespace Tests\Unit\Rules;
use App\Rules\SharedFolderType;
use Illuminate\Support\Facades\Validator;
use Tests\TestCase;
class SharedFolderTypeTest extends TestCase
{
/**
* Tests the shared folder type validator
*/
public function testValidation(): void
{
$rules = ['type' => ['present', new SharedFolderType()]];
// Empty/invalid input
$v = Validator::make(['type' => null], $rules);
$this->assertSame(['type' => ["The specified type is invalid."]], $v->errors()->toArray());
$v = Validator::make(['type' => []], $rules);
$this->assertSame(['type' => ["The specified type is invalid."]], $v->errors()->toArray());
$v = Validator::make(['type' => 'Test'], $rules);
$this->assertSame(['type' => ["The specified type is invalid."]], $v->errors()->toArray());
// Valid type
foreach (\App\SharedFolder::SUPPORTED_TYPES as $type) {
$v = Validator::make(['type' => $type], $rules);
$this->assertSame([], $v->errors()->toArray());
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Jul 9, 7:39 PM (6 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1056417
Default Alt Text
SharedFolderTypeTest.php (1 KB)

Event Timeline