|
|
@@ -119,6 +119,7 @@ class HtmlHelperTest extends TestCase
|
|
|
public function testLink()
|
|
|
{
|
|
|
Router::reload();
|
|
|
+ Router::connect('/:controller', ['action' => 'index']);
|
|
|
Router::connect('/:controller/:action/*');
|
|
|
|
|
|
$this->View->setRequest($this->View->getRequest()->withAttribute('webroot', ''));
|
|
|
@@ -127,18 +128,14 @@ class HtmlHelperTest extends TestCase
|
|
|
$expected = ['a' => ['href' => '/home'], 'preg:/\/home/', '/a'];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $result = $this->Html->link(['action' => 'login', '<[You]>']);
|
|
|
+ $result = $this->Html->link(['controller' => 'users', 'action' => 'login', '<[You]>']);
|
|
|
$expected = [
|
|
|
- 'a' => ['href' => '/login/%3C%5BYou%5D%3E'],
|
|
|
- 'preg:/\/login\/<\[You\]>/',
|
|
|
+ 'a' => ['href' => '/users/login/%3C%5BYou%5D%3E'],
|
|
|
+ 'preg:/\/users\/login\/<\[You\]>/',
|
|
|
'/a',
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- Router::reload();
|
|
|
- Router::connect('/:controller', ['action' => 'index']);
|
|
|
- Router::connect('/:controller/:action/*');
|
|
|
-
|
|
|
$result = $this->Html->link('Posts', ['controller' => 'posts', 'action' => 'index', '_full' => true]);
|
|
|
$expected = ['a' => ['href' => Router::fullBaseUrl() . '/posts'], 'Posts', '/a'];
|
|
|
$this->assertHtml($expected, $result);
|