Skip to content

Commit

Permalink
Fix remaining unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jul 6, 2020
1 parent e0118c4 commit f6f1d19
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
2 changes: 2 additions & 0 deletions core-bundle/src/Resources/contao/pages/PageError404.php
Expand Up @@ -100,6 +100,8 @@ protected function prepare()
}
else
{
Input::setGet('language', $objRootPage->language);

if ($strRequest == Environment::get('request'))
{
$strRequest = $objRootPage->language . '/' . $strRequest;
Expand Down
4 changes: 2 additions & 2 deletions core-bundle/src/Routing/Content/ContentRoute.php
Expand Up @@ -57,7 +57,7 @@ public function __construct(PageModel $page, $content = null)
];

parent::__construct(
'/'.$page->alias,
'/'.($page->alias ?: $page->id),
$defaults,
[],
['utf8' => true],
Expand Down Expand Up @@ -135,7 +135,7 @@ public static function createWithParameters(PageModel $page, string $parameters
{
$route = new self($page, $content);

$route->setPath(sprintf('/%s{parameters}', $page->alias));
$route->setPath(sprintf('/%s{parameters}', $page->alias ?: $page->id));
$route->setDefault('parameters', $parameters);
$route->setRequirement('parameters', $page->requireItem ? '/.+' : '(/.+)?');

Expand Down
Expand Up @@ -81,7 +81,7 @@ public function testMigratesSchema(): void
$this->assertTrue($result->isSuccessful());

$columns = $connection->getSchemaManager()->listTableColumns('tl_page');
$this->assertTrue(isset($columns['urlPrefix']));
$this->assertTrue(isset($columns['urlprefix']));
$this->assertTrue(isset($columns['urlsuffix']));
}

Expand Down
70 changes: 35 additions & 35 deletions core-bundle/tests/Functional/RoutingTest.php
Expand Up @@ -96,7 +96,7 @@ public function getAliases(): \Generator
'/',
200,
'Index - Root with index page',
['language' => 'en'],
[],
'root-with-index.local',
false,
];
Expand All @@ -106,7 +106,7 @@ public function getAliases(): \Generator
'/',
302,
'Redirecting to http://root-with-home.local/home.html',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -116,7 +116,7 @@ public function getAliases(): \Generator
'/home.html',
200,
'Home - Root with home page',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -126,7 +126,7 @@ public function getAliases(): \Generator
'/home//.html',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand Down Expand Up @@ -156,7 +156,7 @@ public function getAliases(): \Generator
'/home/foo/bar1/foo/bar2.html',
404,
'(404 Not Found)',
['language' => 'en', 'foo' => 'bar1'],
['foo' => 'bar1'],
'root-with-home.local',
false,
];
Expand All @@ -166,7 +166,7 @@ public function getAliases(): \Generator
'/home/foo/bar.html',
404,
'(404 Not Found)',
['language' => 'en', 'foo' => 'bar'],
['foo' => 'bar'],
'root-with-home.local',
false,
];
Expand All @@ -176,7 +176,7 @@ public function getAliases(): \Generator
'/home/foo.html',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -186,7 +186,7 @@ public function getAliases(): \Generator
'/home/foo/.html',
404,
'(404 Not Found)',
['language' => 'en', 'foo' => ''],
['foo' => ''],
'root-with-home.local',
false,
];
Expand All @@ -196,7 +196,7 @@ public function getAliases(): \Generator
'/home/items/foobar.html',
200,
'Foobar - Root with home page',
['language' => 'en', 'items' => 'foobar'],
['items' => 'foobar'],
'root-with-home.local',
false,
];
Expand All @@ -206,7 +206,7 @@ public function getAliases(): \Generator
'/home//foo.html',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -226,7 +226,7 @@ public function getAliases(): \Generator
'/h%C3%B6me.html',
200,
'Höme - Root with special chars',
['language' => 'en'],
[],
'root-with-special-chars.local',
false,
];
Expand All @@ -236,7 +236,7 @@ public function getAliases(): \Generator
'/home/foobar.html',
200,
'Foobar - Root with home page',
['language' => 'en', 'auto_item' => 'foobar', 'items' => 'foobar'],
['auto_item' => 'foobar', 'items' => 'foobar'],
'root-with-home.local',
true,
];
Expand All @@ -256,7 +256,7 @@ public function getAliases(): \Generator
'/home/items/foobar.html',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
true,
];
Expand All @@ -266,7 +266,7 @@ public function getAliases(): \Generator
'/',
302,
'Redirecting to http://root-with-folder-urls.local/folder/url/home.html',
['language' => 'en'],
[],
'root-with-folder-urls.local',
false,
];
Expand All @@ -276,7 +276,7 @@ public function getAliases(): \Generator
'/folder/url/home.html',
200,
'Home - Root with folder URLs',
['language' => 'en'],
[],
'root-with-folder-urls.local',
false,
];
Expand All @@ -286,7 +286,7 @@ public function getAliases(): \Generator
'/folder/url/home/items/foobar.html',
200,
'Foobar - Root with folder URLs',
['language' => 'en', 'items' => 'foobar'],
['items' => 'foobar'],
'root-with-folder-urls.local',
false,
];
Expand All @@ -296,7 +296,7 @@ public function getAliases(): \Generator
'/folder/url/home/foobar.html',
200,
'Foobar - Root with folder URLs',
['language' => 'en', 'auto_item' => 'foobar', 'items' => 'foobar'],
['auto_item' => 'foobar', 'items' => 'foobar'],
'root-with-folder-urls.local',
true,
];
Expand All @@ -316,7 +316,7 @@ public function getAliases(): \Generator
'/folder/url/home/items/foobar.html',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-folder-urls.local',
true,
];
Expand All @@ -326,7 +326,7 @@ public function getAliases(): \Generator
'/15.html',
200,
'Home - Page without alias',
['language' => 'en'],
[],
'localhost',
true,
];
Expand Down Expand Up @@ -437,7 +437,7 @@ public function getAliasesWithLocale(): \Generator
'/home.html',
301,
'Redirecting to http://root-with-home.local/en/home.html',
[],
['language' => 'en'],
'root-with-home.local',
false,
];
Expand Down Expand Up @@ -703,7 +703,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/',
200,
'Index - Root with index page',
['language' => 'en'],
[],
'root-with-index.local',
false,
];
Expand All @@ -713,7 +713,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/',
302,
'Redirecting to http://root-with-home.local/home',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -723,7 +723,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home',
200,
'Home - Root with home page',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand Down Expand Up @@ -753,7 +753,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home/foo/bar1/foo/bar2',
404,
'(404 Not Found)',
['language' => 'en', 'foo' => 'bar1'],
['foo' => 'bar1'],
'root-with-home.local',
false,
];
Expand All @@ -763,7 +763,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home/foo/bar',
404,
'(404 Not Found)',
['language' => 'en', 'foo' => 'bar'],
['foo' => 'bar'],
'root-with-home.local',
false,
];
Expand All @@ -773,7 +773,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home/items/foobar',
200,
'Foobar - Root with home page',
['language' => 'en', 'items' => 'foobar'],
['items' => 'foobar'],
'root-with-home.local',
false,
];
Expand All @@ -783,7 +783,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home//foo',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
false,
];
Expand All @@ -793,7 +793,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/h%C3%B6me',
200,
'Höme - Root with special chars',
['language' => 'en'],
[],
'root-with-special-chars.local',
false,
];
Expand All @@ -803,7 +803,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home/foobar',
200,
'Foobar - Root with home page',
['language' => 'en', 'auto_item' => 'foobar', 'items' => 'foobar'],
['auto_item' => 'foobar', 'items' => 'foobar'],
'root-with-home.local',
true,
];
Expand All @@ -823,7 +823,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/home/items/foobar',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-home.local',
true,
];
Expand All @@ -833,7 +833,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/',
302,
'Redirecting to http://root-with-folder-urls.local/folder/url/home',
['language' => 'en'],
[],
'root-with-folder-urls.local',
false,
];
Expand All @@ -843,7 +843,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/folder/url/home',
200,
'Home - Root with folder URLs',
['language' => 'en'],
[],
'root-with-folder-urls.local',
false,
];
Expand All @@ -853,7 +853,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/folder/url/home/items/foobar',
200,
'Foobar - Root with folder URLs',
['language' => 'en', 'items' => 'foobar'],
['items' => 'foobar'],
'root-with-folder-urls.local',
false,
];
Expand All @@ -863,7 +863,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/folder/url/home/foobar',
200,
'Foobar - Root with folder URLs',
['language' => 'en', 'auto_item' => 'foobar', 'items' => 'foobar'],
['auto_item' => 'foobar', 'items' => 'foobar'],
'root-with-folder-urls.local',
true,
];
Expand All @@ -883,7 +883,7 @@ public function getAliasesWithoutUrlSuffix(): \Generator
'/folder/url/home/items/foobar',
404,
'(404 Not Found)',
['language' => 'en'],
[],
'root-with-folder-urls.local',
true,
];
Expand Down

0 comments on commit f6f1d19

Please sign in to comment.