Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112538668
CelerityResourceTransformerTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 11, 06:34
Size
983 B
Mime Type
text/x-php
Expires
Tue, May 13, 06:34 (2 d)
Engine
blob
Format
Raw Data
Handle
26088511
Attached To
rPH Phabricator
CelerityResourceTransformerTestCase.php
View Options
<?php
final
class
CelerityResourceTransformerTestCase
extends
PhabricatorTestCase
{
public
function
testTransformation
()
{
$files
=
dirname
(
__FILE__
).
'/transformer/'
;
foreach
(
Filesystem
::
listDirectory
(
$files
)
as
$file
)
{
$name
=
basename
(
$file
);
$data
=
Filesystem
::
readFile
(
$files
.
'/'
.
$file
);
$parts
=
preg_split
(
'/^~~~+
\n
/m'
,
$data
);
$parts
=
array_merge
(
$parts
,
array
(
null
));
list
(
$options
,
$in
,
$expect
)
=
$parts
;
$parser
=
new
PhutilSimpleOptions
();
$options
=
$parser
->
parse
(
$options
)
+
array
(
'minify'
=>
false
,
'name'
=>
$name
,
);
$xformer
=
new
CelerityResourceTransformer
();
$xformer
->
setRawURIMap
(
array
(
'/rsrc/example.png'
=>
'/res/hash/example.png'
,
));
$xformer
->
setMinify
(
$options
[
'minify'
]);
$result
=
$xformer
->
transformResource
(
$options
[
'name'
],
$in
);
$this
->
assertEqual
(
rtrim
(
$expect
),
rtrim
(
$result
),
$file
);
}
}
}
Event Timeline
Log In to Comment