Skip to content
Permalink
Browse files

Add a test for #12295

  • Loading branch information...
markstory committed Jun 28, 2018
1 parent 55ee598 commit acc11336a3292d64f36c43a581c1a04c0d9ccf1f
Showing with 21 additions and 0 deletions.
  1. +21 −0 tests/TestCase/Routing/Route/RedirectRouteTest.php
@@ -14,6 +14,7 @@
*/
namespace Cake\Test\TestCase\Routing\Route;
use Cake\Http\ServerRequest;
use Cake\Routing\Router;
use Cake\Routing\Route\RedirectRoute;
use Cake\TestSuite\TestCase;
@@ -145,6 +146,26 @@ public function testParsePersist()
$route->parse('/posts/2');
}
/**
* test redirecting with persist and a base directory
*
* @return void
*/
public function testParsePersistBaseDirectory()
{
$request = new ServerRequest([
'base' => '/basedir',
'url' => '/posts/2'
]);
Router::pushRequest($request);
$this->expectException(\Cake\Routing\Exception\RedirectException::class);
$this->expectExceptionMessage('http://localhost/basedir/posts/view/2');
$this->expectExceptionCode(301);
$route = new RedirectRoute('/posts/*', ['controller' => 'posts', 'action' => 'view'], ['persist' => true]);
$route->parse('/posts/2');
}
/**
* test redirecting with persist and string target URLs
*

0 comments on commit acc1133

Please sign in to comment.
You can’t perform that action at this time.