mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
simpletest * opageController::replaceSrc() 테스트 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6537 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
12e2a68dae
commit
3cc3b8cc39
2 changed files with 65 additions and 2 deletions
|
|
@ -11,9 +11,12 @@
|
|||
$oContext = &Context::getInstance();
|
||||
$oContext->init();
|
||||
|
||||
$this->TestSuite('XpressEngine Test');
|
||||
$this->TestSuite('Classes Test');
|
||||
$this->addFile(dirname(__FILE__).'/classes/context/Context.test.php');
|
||||
|
||||
$this->TestSuite('Module Test');
|
||||
$this->addFile(dirname(__FILE__).'/modules/module/module.test.php');
|
||||
$this->addFile(dirname(__FILE__).'/modules/module/opage.test.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
60
tests/modules/module/opage.test.php
Normal file
60
tests/modules/module/opage.test.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
class opageTest extends UnitTestCase {
|
||||
function testReplaceSrc() {
|
||||
$oController = &getController('opage');
|
||||
$this->assertNotNull($oController);
|
||||
|
||||
$path = 'http://domain.com/test_path/opage.php';
|
||||
|
||||
$content = 'src="images/foo.jpg"';
|
||||
$expected_result = 'src="http://domain.com/test_path/images/foo.jpg"';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'src="/images/foo.jpg"';
|
||||
$expected_result = 'src="http://domain.com/images/foo.jpg"';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'src="./images/foo.jpg"';
|
||||
$expected_result = 'src="http://domain.com/test_path/images/foo.jpg"';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'src="../images/foo.jpg"';
|
||||
$expected_result = 'src="http://domain.com/images/foo.jpg"';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'url("./images/foo.jpg")';
|
||||
$expected_result = 'url("http://domain.com/test_path/images/foo.jpg")';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
// 프로토콜
|
||||
// http, https, ftp, telnet, mailto, mms
|
||||
$content = 'href="https://domail.com/"';
|
||||
$expected_result = $content;
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'href="mailto:foo@domain.com"';
|
||||
$expected_result = $content;
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
$content = 'href="mms://domain.com/bar.wmv"';
|
||||
$expected_result = $content;
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
// + 포트번호
|
||||
$path = 'http://domain.com:123/test_path/opage.php';
|
||||
$content = './images/foo.jpg';
|
||||
$expected_result = 'http://domain.com:123/test_path/images/foo.jpg';
|
||||
$result = $oController->replaceSrc($content, $path);
|
||||
$this->assertEqual($expected_result, $result);
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue