Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a3c32ebb
Commit
a3c32ebb
authored
Feb 08, 2017
by
Alex Pott
Browse files
Issue
#2848553
by Sam152, Jaesin, dawehner: Make sure all 'configure' links are valid routes
parent
2fd6026a
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/modules/content_moderation/content_moderation.info.yml
View file @
a3c32ebb
...
...
@@ -4,6 +4,6 @@ description: 'Provides moderation states for content'
version
:
VERSION
core
:
8.x
package
:
Core (Experimental)
configure
:
content_moderation.overview
configure
:
entity.workflow.collection
dependencies
:
-
workflows
core/modules/workflows/workflows.info.yml
View file @
a3c32ebb
...
...
@@ -4,4 +4,4 @@ description: 'Provides UI and API for managing workflows. This module can be use
version
:
VERSION
core
:
8.x
package
:
Core (Experimental)
configure
:
workflow
s.overview
configure
:
entity.
workflow
.collection
core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
View file @
a3c32ebb
...
...
@@ -6,6 +6,7 @@
use
Drupal\Core\Config\InstallStorage
;
use
Drupal\Core\Config\StorageInterface
;
use
Drupal\KernelTests\AssertConfigTrait
;
use
Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait
;
use
Drupal\KernelTests\KernelTestBase
;
/**
...
...
@@ -16,6 +17,7 @@
class
DefaultConfigTest
extends
KernelTestBase
{
use
AssertConfigTrait
;
use
FileSystemModuleDiscoveryDataProviderTrait
;
/**
* {@inheritdoc}
...
...
@@ -61,7 +63,7 @@ protected function setUp() {
/**
* Tests if installed config is equal to the exported config.
*
* @dataProvider
providerTestModuleConfig
* @dataProvider
coreModuleListDataProvider
*/
public
function
testModuleConfig
(
$module
)
{
// System and user are required in order to be able to install some of the
...
...
@@ -142,24 +144,4 @@ protected function doTestsOnConfigStorage(StorageInterface $default_config_stora
}
}
/**
* Test data provider for ::testModuleConfig().
*
* @return array
* An array of module names to test.
*/
public
function
providerTestModuleConfig
()
{
$module_dirs
=
array_keys
(
iterator_to_array
(
new
\
FilesystemIterator
(
__DIR__
.
'/../../../../modules/'
)));
$module_names
=
array_map
(
function
(
$path
)
{
return
str_replace
(
__DIR__
.
'/../../../../modules/'
,
''
,
$path
);
},
$module_dirs
);
$modules_keyed
=
array_combine
(
$module_names
,
$module_names
);
$data
=
array_map
(
function
(
$module
)
{
return
[
$module
];
},
$modules_keyed
);
return
$data
;
}
}
core/tests/Drupal/KernelTests/Core/Extension/ModuleConfigureRouteTest.php
0 → 100644
View file @
a3c32ebb
<?php
namespace
Drupal\KernelTests\Core\Extension
;
use
Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait
;
use
Drupal\KernelTests\KernelTestBase
;
/**
* Tests the configure route for core modules.
*
* @group Module
*/
class
ModuleConfigureRouteTest
extends
KernelTestBase
{
use
FileSystemModuleDiscoveryDataProviderTrait
;
/**
* {@inheritdoc}
*/
public
static
$modules
=
[
'system'
,
'user'
];
/**
* @var \Drupal\Core\Routing\RouteProviderInterface
*/
protected
$routeProvider
;
/**
* An array of module info.
*
* @var array
*/
protected
$moduleInfo
;
/**
* {@inheritdoc}
*/
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
routeProvider
=
\
Drupal
::
service
(
'router.route_provider'
);
$this
->
moduleInfo
=
system_rebuild_module_data
();
}
/**
* Test the module configure routes exist.
*
* @dataProvider coreModuleListDataProvider
*/
function
testModuleConfigureRoutes
(
$module
)
{
$module_info
=
$this
->
moduleInfo
[
$module
]
->
info
;
if
(
isset
(
$module_info
[
'configure'
]))
{
$this
->
container
->
get
(
'module_installer'
)
->
install
([
$module
]);
$route
=
$this
->
routeProvider
->
getRouteByName
(
$module_info
[
'configure'
]);
$this
->
assertNotEmpty
(
$route
,
sprintf
(
'The configure route for the "%s" module was found.'
,
$module
));
}
}
}
core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php
0 → 100644
View file @
a3c32ebb
<?php
namespace
Drupal\KernelTests
;
/**
* A trait used in testing for providing a list of modules in a dataProvider.
*/
trait
FileSystemModuleDiscoveryDataProviderTrait
{
/**
* A data provider that lists every module in core.
*
* @return array
* An array of module names to test.
*/
public
function
coreModuleListDataProvider
()
{
$module_dirs
=
array_keys
(
iterator_to_array
(
new
\
FilesystemIterator
(
__DIR__
.
'/../../../modules/'
)));
$module_names
=
array_map
(
function
(
$path
)
{
return
str_replace
(
__DIR__
.
'/../../../modules/'
,
''
,
$path
);
},
$module_dirs
);
$modules_keyed
=
array_combine
(
$module_names
,
$module_names
);
$data
=
array_map
(
function
(
$module
)
{
return
[
$module
];
},
$modules_keyed
);
return
$data
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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