Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F8221988
SharedFolderTypeTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SharedFolderTypeTest.php
View Options
<?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
Details
Attached
Mime Type
text/x-php
Expires
Thu, Jul 9, 7:38 PM (54 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1056417
Default Alt Text
SharedFolderTypeTest.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment