Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95869615
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
Fri, Dec 20, 03:14
Size
983 B
Mime Type
text/x-php
Expires
Sun, Dec 22, 03:14 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
23049061
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