Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
5eb13a95
Commit
5eb13a95
authored
May 18, 2015
by
catch
Browse files
Issue
#2473907
by alexpott, maijs: Tests not being run by testbot due to missing summary line
parent
99088f65
Changes
34
Hide whitespace changes
Inline
Side-by-side
core/modules/action/tests/src/Unit/Menu/ActionLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\action\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests action local tasks.
*
* @group action
*/
class
ActionLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
ActionLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
'action'
=>
'core/modules/action'
);
...
...
core/modules/aggregator/tests/src/Unit/Menu/AggregatorLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\aggregator\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests existence of aggregator local tasks.
*
* @group aggregator
*/
class
AggregatorLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
AggregatorLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
/**
* {@inheritdoc}
...
...
core/modules/block/tests/src/Unit/Menu/BlockLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\Tests\block\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
use
Symfony\Component\DependencyInjection\ContainerBuilder
;
/**
...
...
@@ -15,7 +15,7 @@
*
* @group block
*/
class
BlockLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
BlockLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
'block'
=>
'core/modules/block'
);
...
...
core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
View file @
5eb13a95
...
...
@@ -8,14 +8,14 @@
namespace
Drupal\block_content\Tests
;
use
Drupal\Component\Utility\Unicode
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
Base
;
/**
* Tests the block content translation UI.
*
* @group block_content
*/
class
BlockContentTranslationUITest
extends
ContentTranslationUITest
{
class
BlockContentTranslationUITest
extends
ContentTranslationUITest
Base
{
/**
* Modules to enable.
...
...
@@ -54,7 +54,7 @@ protected function setupBundle() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getTranslatorPermission().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getTranslatorPermission().
*/
public
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
...
...
@@ -91,7 +91,7 @@ protected function createBlockContent($title = FALSE, $bundle = FALSE) {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getNewEntityValues().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getNewEntityValues().
*/
protected
function
getNewEntityValues
(
$langcode
)
{
return
array
(
'info'
=>
Unicode
::
strtolower
(
$this
->
randomMachineName
()))
+
parent
::
getNewEntityValues
(
$langcode
);
...
...
core/modules/block_content/tests/src/Unit/Menu/BlockContentLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\Tests\block_content\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
use
Symfony\Component\DependencyInjection\ContainerBuilder
;
/**
...
...
@@ -15,7 +15,7 @@
*
* @group block_content
*/
class
BlockContentLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
BlockContentLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
...
...
core/modules/book/tests/src/Unit/Menu/BookLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\book\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests existence of book local tasks.
*
* @group book
*/
class
BookLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
BookLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
...
...
core/modules/comment/src/Tests/CommentTranslationUITest.php
View file @
5eb13a95
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\comment\Tests
;
use
Drupal\comment\Plugin\Field\FieldType\CommentItemInterface
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
Base
;
use
Drupal\language\Entity\ConfigurableLanguage
;
/**
...
...
@@ -16,7 +16,7 @@
*
* @group comment
*/
class
CommentTranslationUITest
extends
ContentTranslationUITest
{
class
CommentTranslationUITest
extends
ContentTranslationUITest
Base
{
use
CommentTestTrait
;
...
...
@@ -49,7 +49,7 @@ protected function setUp() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::setupBundle().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::setupBundle().
*/
function
setupBundle
()
{
parent
::
setupBundle
();
...
...
@@ -66,14 +66,14 @@ function setupBundle() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getTranslatorPermission().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getTranslatorPermission().
*/
protected
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'post comments'
,
'administer comments'
,
'access comments'
));
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::createEntity().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::createEntity().
*/
protected
function
createEntity
(
$values
,
$langcode
,
$comment_type
=
'comment_article'
)
{
if
(
$comment_type
==
'comment_article'
)
{
...
...
@@ -100,7 +100,7 @@ protected function createEntity($values, $langcode, $comment_type = 'comment_art
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getNewEntityValues().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getNewEntityValues().
*/
protected
function
getNewEntityValues
(
$langcode
)
{
// Comment subject is not translatable hence we use a fixed value.
...
...
core/modules/config/tests/src/Unit/Menu/ConfigLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\config\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests existence of config local tasks.
*
* @group config
*/
class
ConfigLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
ConfigLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
'config'
=>
'core/modules/config'
);
...
...
core/modules/content_translation/src/Tests/ContentTestTranslationUITest.php
View file @
5eb13a95
...
...
@@ -12,7 +12,7 @@
*
* @group content_translation
*/
class
ContentTestTranslationUITest
extends
ContentTranslationUITest
{
class
ContentTestTranslationUITest
extends
ContentTranslationUITest
Base
{
/**
* Modules to enable.
...
...
@@ -31,7 +31,7 @@ protected function setUp() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getTranslatorPermission().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getTranslatorPermission().
*/
protected
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'administer entity_test content'
));
...
...
core/modules/content_translation/src/Tests/ContentTranslationUITest.php
→
core/modules/content_translation/src/Tests/ContentTranslationUITest
Base
.php
View file @
5eb13a95
...
...
@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationUITest.
* Contains \Drupal\content_translation\Tests\ContentTranslationUITest
Base
.
*/
namespace
Drupal\content_translation\Tests
;
...
...
@@ -16,7 +16,7 @@
/**
* Tests the Content Translation UI.
*/
abstract
class
ContentTranslationUITest
extends
ContentTranslationTestBase
{
abstract
class
ContentTranslationUITest
Base
extends
ContentTranslationTestBase
{
/**
* The id of the entity being translated.
...
...
core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\content_translation\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests content translation local tasks.
*
* @group content_translation
*/
class
ContentTranslationLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
ContentTranslationLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
...
...
core/modules/language/tests/src/Unit/Menu/LanguageLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\language\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests existence of language local tasks.
*
* @group language
*/
class
LanguageLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
LanguageLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
...
...
core/modules/locale/tests/src/Unit/Menu/LocaleLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\locale\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests locale local tasks.
*
* @group locale
*/
class
LocaleLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
LocaleLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
/**
* {@inheritdoc}
...
...
core/modules/menu_link_content/src/Tests/MenuLinkContentUITest.php
View file @
5eb13a95
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\menu_link_content\Tests
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
Base
;
use
Drupal\menu_link_content
\
Entity\MenuLinkContent
;
/**
...
...
@@ -15,7 +15,7 @@
*
* @group Menu
*/
class
MenuLinkContentUITest
extends
ContentTranslationUITest
{
class
MenuLinkContentUITest
extends
ContentTranslationUITest
Base
{
/**
* Modules to enable.
...
...
core/modules/node/src/Tests/NodeTranslationUITest.php
View file @
5eb13a95
...
...
@@ -8,7 +8,7 @@
namespace
Drupal\node\Tests
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
Base
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\Core\Url
;
use
Drupal\node\Entity\Node
;
...
...
@@ -18,7 +18,7 @@
*
* @group node
*/
class
NodeTranslationUITest
extends
ContentTranslationUITest
{
class
NodeTranslationUITest
extends
ContentTranslationUITest
Base
{
/**
* Modules to enable.
...
...
@@ -58,7 +58,7 @@ function testTranslationUI() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getTranslatorPermission().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getTranslatorPermission().
*/
protected
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'administer nodes'
,
"edit any
$this->bundle
content"
));
...
...
@@ -79,7 +79,7 @@ protected function getAdministratorPermissions() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::getNewEntityValues().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::getNewEntityValues().
*/
protected
function
getNewEntityValues
(
$langcode
)
{
return
array
(
'title'
=>
array
(
array
(
'value'
=>
$this
->
randomMachineName
())))
+
parent
::
getNewEntityValues
(
$langcode
);
...
...
@@ -98,7 +98,7 @@ protected function getFormSubmitAction(EntityInterface $entity, $langcode) {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertPublishedStatus().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::assertPublishedStatus().
*/
protected
function
doTestPublishedStatus
()
{
$entity
=
entity_load
(
$this
->
entityTypeId
,
$this
->
entityId
,
TRUE
);
...
...
@@ -129,7 +129,7 @@ protected function doTestPublishedStatus() {
}
/**
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::assertAuthoringInfo().
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest
Base
::assertAuthoringInfo().
*/
protected
function
doTestAuthoringInfo
()
{
$entity
=
entity_load
(
$this
->
entityTypeId
,
$this
->
entityId
,
TRUE
);
...
...
core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php
View file @
5eb13a95
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\shortcut\Tests
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
;
use
Drupal\content_translation
\
Tests\ContentTranslationUITest
Base
;
use
Drupal\Core\Entity\EntityChangedInterface
;
use
Drupal\Core\Language\Language
;
...
...
@@ -16,7 +16,7 @@
*
* @group Shortcut
*/
class
ShortcutTranslationUITest
extends
ContentTranslationUITest
{
class
ShortcutTranslationUITest
extends
ContentTranslationUITest
Base
{
/**
* Modules to enable.
...
...
core/modules/shortcut/tests/src/Unit/Menu/ShortcutLocalTasksTest.php
View file @
5eb13a95
...
...
@@ -7,14 +7,14 @@
namespace
Drupal\Tests\shortcut\Unit\Menu
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
;
use
Drupal\Tests\Core\Menu\LocalTaskIntegrationTest
Base
;
/**
* Tests existence of shortcut local tasks.
*
* @group shortcut
*/
class
ShortcutLocalTasksTest
extends
LocalTaskIntegrationTest
{
class
ShortcutLocalTasksTest
extends
LocalTaskIntegrationTest
Base
{
protected
function
setUp
()
{
$this
->
directoryList
=
array
(
...
...
core/modules/simpletest/src/TestDiscovery.php
View file @
5eb13a95
...
...
@@ -160,9 +160,13 @@ public function getTestClasses($extension = NULL) {
try
{
$info
=
static
::
getTestInfo
(
$classname
,
$parser
->
getDocComment
());
}
catch
(
\
LogicException
$e
)
{
// If the class is missing a summary line or an @group annotation just
// skip it. Most likely it is an abstract class, trait or test fixture.
catch
(
MissingGroupException
$e
)
{
// If the class name ends in Test and is not a migrate table dump.
if
(
preg_match
(
'/Test$/'
,
$classname
)
&&
strpos
(
$classname
,
'migrate_drupal\Tests\Table'
)
===
FALSE
)
{
throw
$e
;
}
// If the class is @group annotation just skip it. Most likely it is an
// abstract class, trait or test fixture.
continue
;
}
// Skip this test class if it requires unavailable modules.
...
...
core/modules/system/src/Tests/RouteProcessor/RouteNoneTest.php
View file @
5eb13a95
...
...
@@ -9,12 +9,15 @@
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Cache\CacheableMetadata
;
use
Drupal\Core\GeneratedUrl
;
use
Drupal\simpletest\KernelTestBase
;
use
Symfony\Cmf\Component\Routing\RouteObjectInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Route
;
/**
* Tests the <none> route processor.
*
* @see system.routing.yml
* @see \Drupal\Core\Routing\UrlGenerator
* @group route_processor
...
...
@@ -67,8 +70,10 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
''
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$this
->
assertEqual
([
'#test-fragment'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
''
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'#test-fragment'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
// Test request with subdir on other page.
$server
=
[
...
...
@@ -82,8 +87,10 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
''
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$this
->
assertEqual
([
'#test-fragment'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
''
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'#test-fragment'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
// Test request without subdir on the homepage.
$server
=
[
...
...
@@ -97,8 +104,10 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
''
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$this
->
assertEqual
([
'#test-fragment'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
''
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'#test-fragment'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
// Test request without subdir on other page.
$server
=
[
...
...
@@ -112,8 +121,10 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
''
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$this
->
assertEqual
([
'#test-fragment'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
''
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[],
TRUE
,
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'#test-fragment'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<none>'
,
[],
[
'fragment'
=>
'test-fragment'
],
TRUE
));
}
}
core/modules/system/src/Tests/RouteProcessor/RouteProcessorCurrentIntegrationTest.php
View file @
5eb13a95
...
...
@@ -9,12 +9,15 @@
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Cache\CacheableMetadata
;
use
Drupal\Core\GeneratedUrl
;
use
Drupal\simpletest\KernelTestBase
;
use
Symfony\Cmf\Component\Routing\RouteObjectInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Route
;
/**
* Tests the <current> route processor.
*
* @see \Drupal\Core\RouteProcessor\RouteProcessorCurrent
* @group route_processor
*/
...
...
@@ -68,7 +71,8 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
'/subdir/'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'/subdir/'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
// Test request with subdir on other page.
$server
=
[
...
...
@@ -82,7 +86,8 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
'/subdir/node/add'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'/subdir/node/add'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
// Test request without subdir on the homepage.
$server
=
[
...
...
@@ -96,7 +101,8 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
'/'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'/'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
// Test request without subdir on other page.
$server
=
[
...
...
@@ -110,7 +116,8 @@ public function testProcessOutbound() {
$request_stack
->
push
(
$request
);
$request_context
->
fromRequest
(
$request
);
$this
->
assertEqual
([
'/node/add'
,
$expected_cacheability
],
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
(
$expected_cacheability
)
->
setGeneratedUrl
(
'/node/add'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
// Test request without a found route. This happens for example on an
// not found exception page.
...
...
@@ -126,7 +133,8 @@ public function testProcessOutbound() {
// In case we have no routing, the current route should point to the front,
// and the cacheability does not depend on the 'route' cache context, since
// no route was involved at all: this is fallback behavior.
$this
->
assertEqual
([
'/'
,
(
new
CacheableMetadata
())
->
setCacheMaxAge
(
Cache
::
PERMANENT
)],
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
$url
=
GeneratedUrl
::
createFromObject
((
new
CacheableMetadata
())
->
setCacheMaxAge
(
Cache
::
PERMANENT
))
->
setGeneratedUrl
(
'/'
);
$this
->
assertEqual
(
$url
,
$this
->
urlGenerator
->
generateFromRoute
(
'<current>'
,
[],
[],
TRUE
));
}
}
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment