Ignore:
Timestamp:
2007/07/24 14:14:05 (17 years ago)
Author:
nanasess
Message:

LC_Page::getLocation() のテストケース追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/test/class/page/LC_Page_Test.php

    r15116 r15118  
    1515 * @package Page 
    1616 * @author LOCKON CO.,LTD. 
    17  * @version $Id$ 
     17 * @version $Id:LC_Page_Test.php 15116 2007-07-23 11:32:53Z nanasess $ 
    1818 */ 
    1919class LC_Page_Test extends PHPUnit_TestCase { 
     
    110110        $this->assertEquals(1, preg_match("/[a-f0-9]{40,}/", LC_Page::createToken())); 
    111111    } 
     112 
     113    /** 
     114     * LC_Page::getLocation() のテストケース. 
     115     */ 
     116    function testGetLocation() { 
     117        $objPage = new LC_Page(); 
     118        $_SERVER['DOCUMENT_ROOT'] = realpath("../../../html"); 
     119        $url = $objPage->getLocation("../../../html/abouts/index.php"); 
     120 
     121        $this->assertEquals(SITE_URL . "abouts/index.php", $url); 
     122        unset($_SERVER['DOCUMENT_ROOT']); 
     123    } 
     124 
     125    /** 
     126     * LC_Page::getLocation() のテストケース. 
     127     * 
     128     * QueryString 付与 
     129     */ 
     130    function testGetLocationWithQueryString() { 
     131        $objPage = new LC_Page(); 
     132        $_SERVER['DOCUMENT_ROOT'] = realpath("../../../html"); 
     133 
     134        $queryString = array("mode" => "update", "type" => "text"); 
     135        $url = $objPage->getLocation("../../../html/abouts/index.php", $queryString); 
     136 
     137        $this->assertEquals(SITE_URL . "abouts/index.php?mode=update&type=text", $url); 
     138        unset($_SERVER['DOCUMENT_ROOT']); 
     139    } 
     140 
     141    /** 
     142     * LC_Page::getLocation() のテストケース. 
     143     * 
     144     * SSL_URL 使用 
     145     */ 
     146    function testGetLocationUseSSL() { 
     147        $objPage = new LC_Page(); 
     148        $_SERVER['DOCUMENT_ROOT'] = realpath("../../../html"); 
     149 
     150        $queryString = array("mode" => "update", "type" => "text"); 
     151        $url = $objPage->getLocation("../../../html/abouts/index.php", $queryString, true); 
     152 
     153        $this->assertEquals(SSL_URL . "abouts/index.php?mode=update&type=text", $url); 
     154        unset($_SERVER['DOCUMENT_ROOT']); 
     155    } 
     156 
     157    /** 
     158     * LC_Page::getLocation() のテストケース. 
     159     * 
     160     * DocumentRoot 指定 
     161     */ 
     162    function testGetLocationWithDocumentRoot() { 
     163        $objPage = new LC_Page(); 
     164        $documentRoot = realpath("../../../html"); 
     165 
     166        $queryString = array("mode" => "update", "type" => "text"); 
     167        $url = $objPage->getLocation("../../../html/abouts/index.php", array(), 
     168                                     false, $documentRoot); 
     169 
     170        $this->assertEquals(SITE_URL . "abouts/index.php", $url); 
     171    } 
    112172} 
    113173?> 
Note: See TracChangeset for help on using the changeset viewer.