Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PMA_securePath_test.php « core « libraries « test - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c3663b8ea44bd196d0df19937e5fabccd883865a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * PMA_securePath changes .. to .
 *
 * @package PhpMyAdmin-test
 */


/**
 * Test for securing path.
 *
 * @package PhpMyAdmin-test
 */
class PMA_SecurePath extends PHPUnit_Framework_TestCase
{
    /**
     * Test for replacing dots.
     *
     * @return void
     */
    public function testReplaceDots()
    {
        $this->assertEquals(
            PMA_securePath('../../../etc/passwd'),
            './././etc/passwd'
        );
        $this->assertEquals(
            PMA_securePath('/var/www/../phpmyadmin'),
            '/var/www/./phpmyadmin'
        );
        $this->assertEquals(
            PMA_securePath('./path/with..dots/../../file..php'),
            './path/with.dots/././file.php'
        );
    }

}