Ignore:
Timestamp:
2014/08/28 15:58:05 (10 years ago)
Author:
kimoto
Message:

#150 ユニットテスト環境の整備
isAbsoluteRealPathが相対パス混じりでもtrueを返していたのでテストの追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php

    r23546 r23609  
    3636 
    3737 
    38   protected function setUp() 
    39   { 
    40     // parent::setUp(); 
    41   } 
     38    protected function setUp() 
     39    { 
     40        // parent::setUp(); 
     41    } 
    4242 
    43   protected function tearDown() 
    44   { 
    45     // parent::tearDown(); 
    46   } 
     43    protected function tearDown() 
     44    { 
     45        // parent::tearDown(); 
     46    } 
    4747 
    48   ///////////////////////////////////////// 
    49   public function testIsAbsoluteRealPath_絶対パスの場合_trueが返る() 
    50   { 
     48    ///////////////////////////////////////// 
     49    public function testIsAbsoluteRealPath_絶対パスの場合_trueが返る() 
     50    { 
    5151 
    52     if (strpos(PHP_OS, 'WIN')) { 
    53       $input = 'C:/Program Files/username/hoge/hoge.txt'; 
    54     } else { 
    55       $input = '/etc/php.ini'; 
     52        if (strpos(PHP_OS, 'WIN')) { 
     53            $input = 'C:/Program Files/username/hoge/hoge.txt'; 
     54        } else { 
     55            $input = '/etc/php.ini'; 
     56        } 
     57        $this->expected = true; 
     58        $this->actual = SC_Utils::isAbsoluteRealPath($input); 
     59 
     60        $this->verify(); 
    5661    } 
    57     $this->expected = true; 
    58     $this->actual = SC_Utils::isAbsoluteRealPath($input); 
    5962 
    60     $this->verify(); 
    61   } 
     63    public function testIsAbsoluteRealPath_相対パスの場合_trueが返る() 
     64    { 
    6265 
    63   public function testIsAbsoluteRealPath_相対パスの場合_trueが返る() 
    64   { 
     66        if (strpos(PHP_OS, 'WIN')) { 
     67            $input = './system32/hoge/hoge.txt'; 
     68        } else { 
     69            $input = '../etc/php.ini'; 
     70        } 
     71        $this->expected = false; 
     72        $this->actual = SC_Utils::isAbsoluteRealPath($input); 
    6573 
    66     if (strpos(PHP_OS, 'WIN')) { 
    67       $input = './system32/hoge/hoge.txt'; 
    68     } else { 
    69       $input = '../etc/php.ini'; 
     74        $this->verify(); 
    7075    } 
    71     $this->expected = false; 
    72     $this->actual = SC_Utils::isAbsoluteRealPath($input); 
    7376 
    74     $this->verify(); 
    75   } 
    7677 
    77   ////////////////////////////////////////// 
     78    public function testIsAbsoluteRealPath_絶対パスに相対パスが混じっている場合_falseが返る() 
     79    { 
     80        if (strpos(PHP_OS, 'WIN')) { 
     81            $input = 'C:/path/to/eccube/html/../data/hoge.txt'; 
     82        } else { 
     83            $input = '/path/to/eccube/html/../data/hoge.txt'; 
     84        } 
     85        $this->expected = false; 
     86        $this->actual = SC_Utils::isAbsoluteRealPath($input); 
     87 
     88        $this->verify(); 
     89    } 
     90 
     91    ////////////////////////////////////////// 
    7892} 
    79  
Note: See TracChangeset for help on using the changeset viewer.