Browse Source

Fix tests.

mscherer 6 years ago
parent
commit
1e315a153e

+ 3 - 4
tests/TestCase/View/Helper/HtmlHelperTest.php

@@ -60,16 +60,15 @@ class HtmlHelperTest extends TestCase {
 
 		$request = $this->Html->getView()->getRequest();
 		$request = $request->withAttribute('here', '/admin/foobar/test')
-			->withParam('admin', true)
-			->withParam('prefix', 'admin');
+			->withParam('prefix', 'Admin');
 		$this->Html->getView()->setRequest($request);
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::prefix('admin', function (RouteBuilder $routes) {
+		Router::prefix('Admin', function (RouteBuilder $routes) {
 			$routes->connect('/:controller/:action/*');
 		});
 
-		$result = $this->Html->link('Foo', ['prefix' => 'admin', 'controller' => 'foobar', 'action' => 'test']);
+		$result = $this->Html->link('Foo', ['prefix' => 'Admin', 'controller' => 'foobar', 'action' => 'test']);
 		$expected = '<a href="/admin/foobar/test">Foo</a>';
 		$this->assertEquals($expected, $result);
 

+ 7 - 7
tests/TestCase/View/Helper/UrlHelperTest.php

@@ -45,16 +45,16 @@ class UrlHelperTest extends TestCase {
 
 		$request = $this->Url->getView()->getRequest();
 		$request = $request->withAttribute('here', '/admin/foobar/test')
-			->withParam('prefix', 'admin');
+			->withParam('prefix', 'Admin');
 		$this->Url->getView()->setRequest($request);
 		Router::reload();
 		Router::connect('/:controller/:action/*');
-		Router::prefix('admin', function (RouteBuilder $routes) {
+		Router::prefix('Admin', function (RouteBuilder $routes) {
 			$routes->fallbacks();
 		});
-		Router::pushRequest($this->Url->getView()->getRequest());
+		Router::setRequest($this->Url->getView()->getRequest());
 
-		$result = $this->Url->build(['prefix' => 'admin', 'controller' => 'foobar', 'action' => 'test']);
+		$result = $this->Url->build(['prefix' => 'Admin', 'controller' => 'foobar', 'action' => 'test']);
 		$expected = '/admin/foobar/test';
 		$this->assertSame($expected, $result);
 
@@ -79,7 +79,7 @@ class UrlHelperTest extends TestCase {
 
 		$request = $this->Url->getView()->getRequest();
 		$request = $request->withAttribute('here', '/admin/foo/bar/baz/test')
-			->withParam('prefix', 'admin')
+			->withParam('prefix', 'Admin')
 			->withParam('plugin', 'Foo');
 		$this->Url->getView()->setRequest($request);
 		Router::reload();
@@ -87,12 +87,12 @@ class UrlHelperTest extends TestCase {
 		Router::plugin('Foo', function (RouteBuilder $routes) {
 			$routes->fallbacks();
 		});
-		Router::prefix('admin', function (RouteBuilder $routes) {
+		Router::prefix('Admin', function (RouteBuilder $routes) {
 			$routes->plugin('Foo', function (RouteBuilder $routes) {
 				$routes->fallbacks();
 			});
 		});
-		Router::pushRequest($this->Url->getView()->getRequest());
+		Router::setRequest($this->Url->getView()->getRequest());
 
 		$result = $this->Url->build(['controller' => 'bar', 'action' => 'baz', 'x']);
 		$expected = '/admin/foo/bar/baz/x';