Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!2918
Issue
#3293469
: [Plan] Automated A11y tests in Nightwatch
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Issue
#3293469
: [Plan] Automated A11y tests in Nightwatch
issue/drupal-3293469:10x-a11y-test
into
10.1.x
Overview
9
Commits
9
Pipelines
0
Changes
27
All threads resolved!
Hide all comments
Closed
Ben Mullins
requested to merge
issue/drupal-3293469:10x-a11y-test
into
10.1.x
2 years ago
Overview
9
Commits
9
Pipelines
0
Changes
27
All threads resolved!
Hide all comments
Expand
0
0
Merge request reports
Compare
10.1.x
version 13
02680f4d
2 years ago
version 12
eb6aaf73
2 years ago
version 11
4d97e883
2 years ago
version 10
ac6168c3
2 years ago
version 9
804002ad
2 years ago
version 8
19519159
2 years ago
version 7
11726159
2 years ago
version 6
cebfee56
2 years ago
version 5
79887190
2 years ago
version 4
2c5c77c3
2 years ago
version 3
f432f7e9
2 years ago
version 2
e42cf20f
2 years ago
version 1
dc017b6d
2 years ago
10.1.x (base)
and
latest version
latest version
81bd84de
9 commits,
2 years ago
version 13
02680f4d
7 commits,
2 years ago
version 12
eb6aaf73
7 commits,
2 years ago
version 11
4d97e883
7 commits,
2 years ago
version 10
ac6168c3
6 commits,
2 years ago
version 9
804002ad
6 commits,
2 years ago
version 8
19519159
6 commits,
2 years ago
version 7
11726159
7 commits,
2 years ago
version 6
cebfee56
6 commits,
2 years ago
version 5
79887190
5 commits,
2 years ago
version 4
2c5c77c3
4 commits,
2 years ago
version 3
f432f7e9
3 commits,
2 years ago
version 2
e42cf20f
2 commits,
2 years ago
version 1
dc017b6d
1 commit,
2 years ago
27 files
+
765
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
27
Search (e.g. *.vue) (Ctrl+P)
core/modules/system/tests/modules/nightwatch_theme_install_utility/src/Controller/ThemeInstallController.php
0 → 100644
+
93
−
0
Options
<?php
namespace
Drupal\nightwatch_theme_install_utility\Controller
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Extension\ThemeInstallerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
* Provides an easier way for Nightwatch tests to install themes.
*/
class
ThemeInstallController
extends
ControllerBase
{
/**
* The theme installer service.
*
* @var \Drupal\Core\Extension\ThemeInstallerInterface
*/
protected
$themeInstaller
;
/**
* Constructs a new ThemeInstallController.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer
* The theme installer.
*/
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
ThemeInstallerInterface
$theme_installer
)
{
$this
->
configFactory
=
$config_factory
;
$this
->
themeInstaller
=
$theme_installer
;
}
/**
* {@inheritdoc}
*/
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'config.factory'
),
$container
->
get
(
'theme_installer'
)
);
}
/**
* Install a theme as default.
*
* @param string $theme
* The theme to install as the default theme.
*
* @return array
* A render array confirming installation.
*/
public
function
installDefault
(
string
$theme
)
{
return
$this
->
installTheme
(
$theme
,
'default'
);
}
/**
* Install a theme as the admin theme.
* @param string $theme
* The theme to install as the admin theme.
*
* @return array
* A render array confirming installation.
*/
public
function
installAdmin
(
$theme
)
{
return
$this
->
installTheme
(
$theme
,
'admin'
);
}
/**
* Installs a theme.
*
* @param string $theme
* The theme to install.
* @param string $default_or_admin
* Which type of theme to install, can be `default` or `admin`.
*
* @return array
* A render array confirming installation.
*/
private
function
installTheme
(
$theme
,
$default_or_admin
):
array
{
assert
(
in_array
(
$default_or_admin
,
[
'default'
,
'admin'
]),
'The $default_or_admin parameter must be `default` or `admin`'
);
$config
=
$this
->
configFactory
->
getEditable
(
'system.theme'
);
$this
->
themeInstaller
->
install
([
$theme
]);
$config
->
set
(
$default_or_admin
,
$theme
)
->
save
();
return
[
'#type'
=>
'container'
,
'#attributes'
=>
[
'id'
=>
'theme-installed'
],
'#markup'
=>
"Installed
$theme
as
$default_or_admin
theme"
,
];
}
}
Loading