Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3295309
PhutilEditorConfigTestCase.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
2 KB
Referenced Files
None
Subscribers
None
PhutilEditorConfigTestCase.php
View Options
<?php
final
class
PhutilEditorConfigTestCase
extends
PhutilTestCase
{
public
function
testGetProperty
(
)
{
$parser
=
new
PhutilEditorConfig
(
$this
->
getTestFile
(
)
)
;
$tests
=
array
(
'default'
=>
array
(
array
(
'indent_style'
=>
'space'
,
'indent_size'
=>
2
,
'charset'
=>
'utf-8'
,
'trim_trailing_whitespace'
=>
true
,
'insert_final_newline'
=>
true
,
)
,
array
(
)
,
)
,
'file'
=>
array
(
array
(
'indent_style'
=>
'space'
,
'indent_size'
=>
3
,
'charset'
=>
'utf-8'
,
'trim_trailing_whitespace'
=>
true
,
'insert_final_newline'
=>
true
,
)
,
array
(
)
,
)
,
'file.txt'
=>
array
(
array
(
'indent_style'
=>
'space'
,
'indent_size'
=>
3
,
'charset'
=>
'latin1'
,
'trim_trailing_whitespace'
=>
true
,
'insert_final_newline'
=>
true
,
)
,
array
(
)
,
)
,
'externals/README'
=>
array
(
array
(
'indent_style'
=>
null
,
'indent_size'
=>
null
,
'charset'
=>
'utf-8'
,
'trim_trailing_whitespace'
=>
false
,
'insert_final_newline'
=>
false
,
)
,
array
(
)
,
)
,
'subdir/file'
=>
array
(
array
(
'indent_style'
=>
'tab'
,
'indent_size'
=>
3
,
'charset'
=>
'utf-8-bom'
,
'trim_trailing_whitespace'
=>
true
,
'insert_final_newline'
=>
true
,
)
,
array
(
)
,
)
,
'empty/file'
=>
array
(
array
(
)
,
array
(
'indent_style'
=>
null
,
'indent_size'
=>
null
,
'charset'
=>
null
,
'trim_trailing_whitespace'
=>
null
,
'insert_final_newline'
=>
null
,
)
,
)
,
)
;
foreach
(
$tests
as
$path
=>
$expected
)
{
list
(
$properties
,
$property
)
=
$expected
;
$property
=
array_merge
(
$properties
,
$property
)
;
$this
->
assertEqual
(
$properties
,
$parser
->
getProperties
(
$this
->
getTestFile
(
$path
)
)
)
;
foreach
(
$property
as
$key
=>
$value
)
{
$this
->
assertEqual
(
$value
,
$parser
->
getProperty
(
$this
->
getTestFile
(
$path
)
,
$key
)
)
;
}
}
$invalid_properties
=
array
(
'invalid'
,
)
;
foreach
(
$invalid_properties
as
$invalid_property
)
{
$caught
=
null
;
try
{
$parser
->
getProperty
(
''
,
$invalid_property
)
;
}
catch
(
Exception
$ex
)
{
$caught
=
$ex
;
}
$this
->
assertTrue
(
$caught
instanceof
InvalidArgumentException
)
;
}
}
private
function
getTestFile
(
$path
=
null
)
{
return
dirname
(
__FILE__
)
.
'/editorconfig/'
.
$path
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Mar 27, 01:43 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116150
Default Alt Text
PhutilEditorConfigTestCase.php (2 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment