Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893886
AlmanacNamesTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
AlmanacNamesTestCase.php
View Options
<?php
final
class
AlmanacNamesTestCase
extends
PhabricatorTestCase
{
public
function
testServiceOrDeviceNames
(
)
{
$map
=
array
(
''
=>
false
,
'a'
=>
false
,
'ab'
=>
false
,
'...'
=>
false
,
'ab.'
=>
false
,
'.ab'
=>
false
,
'A-B'
=>
false
,
'A!B'
=>
false
,
'A.B'
=>
false
,
'a..b'
=>
false
,
'1.2'
=>
false
,
'127.0.0.1'
=>
false
,
'1.b'
=>
false
,
'a.1'
=>
false
,
'a.1.b'
=>
false
,
'-.a'
=>
false
,
'-a.b'
=>
false
,
'a-.b'
=>
false
,
'a.-'
=>
false
,
'a.-b'
=>
false
,
'a.b-'
=>
false
,
'-.-'
=>
false
,
'a--b'
=>
false
,
'abc'
=>
true
,
'a.b'
=>
true
,
'db.companyname.instance'
=>
true
,
'web002.useast.example.com'
=>
true
,
'master.example-corp.com'
=>
true
,
// Maximum length is 100.
str_repeat
(
'a'
,
100
)
=>
true
,
str_repeat
(
'a'
,
101
)
=>
false
,
)
;
foreach
(
$map
as
$input
=>
$expect
)
{
$caught
=
null
;
try
{
AlmanacNames
::
validateName
(
$input
)
;
}
catch
(
Exception
$ex
)
{
$caught
=
$ex
;
}
$this
->
assertEqual
(
$expect
,
!
(
$caught
instanceof
Exception
)
,
$input
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:09 (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127754
Default Alt Text
AlmanacNamesTestCase.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment