Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117752201
BaseReplacer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
BaseReplacer.php
View Options
<?php
/**
* Test class to test rcube_base_replacer class
*
* @package Tests
*/
class
Framework_BaseReplacer
extends
PHPUnit\Framework\TestCase
{
/**
* Class constructor
*/
function
test_class
()
{
$object
=
new
rcube_base_replacer
(
'test'
);
$this
->
assertInstanceOf
(
'rcube_base_replacer'
,
$object
,
"Class constructor"
);
}
/**
* Test replace()
*/
function
test_replace
()
{
$base
=
'http://thisshouldntbetheurl.bob.com/'
;
$html
=
'<A href=http://shouldbethislink.com>Test URL</A>'
;
$replacer
=
new
rcube_base_replacer
(
$base
);
$response
=
$replacer
->
replace
(
$html
);
$this
->
assertSame
(
'<A href="http://shouldbethislink.com">Test URL</A>'
,
$response
);
}
/**
* Data for absolute_url() test
*/
function
data_absolute_url
()
{
return
array
(
array
(
''
,
'http://test'
,
'http://test/'
),
array
(
'http://test'
,
'http://anything'
,
'http://test'
),
array
(
'cid:test'
,
'http://anything'
,
'cid:test'
),
array
(
'/test'
,
'http://test'
,
'http://test/test'
),
array
(
'./test'
,
'http://test'
,
'http://test/test'
),
array
(
'../test1'
,
'http://test/test2'
,
'http://test1'
),
array
(
'../test1'
,
'http://test/test2/'
,
'http://test/test1'
),
);
}
/**
* Test absolute_url()
* @dataProvider data_absolute_url
*/
function
test_absolute_url
(
$path
,
$base
,
$expected
)
{
$replacer
=
new
rcube_base_replacer
(
'test'
);
$result
=
$replacer
->
absolute_url
(
$path
,
$base
);
$this
->
assertSame
(
$expected
,
$result
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 3:51 AM (3 d, 11 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7d/49/6428f028eda86c8697c3b27650bb
Default Alt Text
BaseReplacer.php (1 KB)
Attached To
Mode
R113 roundcubemail
Attached
Detach File
Event Timeline