This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/HttpFoundation/ApacheRequestTest.php
2011-03-16 06:13:01 -07:00

40 lines
1.1 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Component\HttpFoundation;
use Symfony\Component\HttpFoundation\ApacheRequest;
class ApacheRequestTest extends \PHPUnit_Framework_TestCase
{
public function testGetBaseUrlDoesNotForceScriptName()
{
$request = new ApacheRequest();
$request->server->replace(array(
'REQUEST_URI' => '/foo/bar',
'SCRIPT_NAME' => '/index.php',
));
$this->assertEquals('', $request->getBaseUrl(), '->getBaseUrl() does not add the script name');
}
public function testGetBaseUrlIncludesScriptName()
{
$request = new ApacheRequest();
$request->server->replace(array(
'REQUEST_URI' => '/index.php/foo/bar',
'SCRIPT_NAME' => '/index.php',
));
$this->assertEquals('/index.php', $request->getBaseUrl(), '->getBaseUrl() includes the script name');
}
}