/usr/share/php/tests/Horde_Controller/Horde/Controller/MockRequestTest.php is in php-horde-controller 2.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | <?php
/**
* Test the mock request handler.
*
* PHP version 5
*
* @category Horde
* @package Controller
* @subpackage UnitTests
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/bsd
*/
/**
* Test the mock request handler.
*
* Copyright 2011-2012 Horde LLC (http://www.horde.org/)
*
* @category Horde
* @package Controller
* @subpackage UnitTests
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/bsd
*/
class Horde_Controller_MockRequestTest extends Horde_Test_Case
{
public function testEmptyGetPath()
{
$r = new Horde_Controller_Request_Mock();
$this->assertNull($r->getPath());
}
public function testSetPath()
{
$r = new Horde_Controller_Request_Mock();
$r->setPath('R');
$this->assertEquals('R', $r->getPath());
}
public function testGetPathRedirectUrl()
{
$r = new Horde_Controller_Request_Mock(
array('SERVER' => array('REDIRECT_URL' => 'RE'))
);
$this->assertEquals('RE', $r->getPath());
}
public function testGetPathRequestUri()
{
$r = new Horde_Controller_Request_Mock(
array('SERVER' => array('REQUEST_URI' => 'RU'))
);
$this->assertEquals('RU', $r->getPath());
}
/**
* @dataProvider provideGets
*/
public function testGetGetVars($method, $key, $value)
{
$r = new Horde_Controller_Request_Mock(array($key => $value));
$this->assertEquals($value, $r->{$method}());
}
public function provideGets()
{
return array(
array('getGetVars', 'GET', array('X' => 'Y')),
array('getFileVars', 'files', array('X' => 'Y')),
array('getServerVars', 'server', array('X' => 'Y')),
array('getPostVars', 'POST', array('X' => 'Y')),
array('getCookieVars', 'cookie', array('X' => 'Y')),
array('getRequestVars', 'REQUEST', array('X' => 'Y')),
);
}
public function testGetHeaders()
{
$r = new Horde_Controller_Request_Mock(
array('SERVER' => array('HTTP_TEST' => 'test'))
);
$this->assertEquals(array('test' => 'test'), $r->getHeaders());
}
public function testGetHeaderNames()
{
$r = new Horde_Controller_Request_Mock(
array('SERVER' => array('HTTP_TEST' => 'test'))
);
$this->assertEquals(array('test'), $r->getHeaderNames());
}
}
|