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
Commits
1d6b9c7e
Commit
1d6b9c7e
authored
1 year ago
by
Michael Strelan
Committed by
Michael Strelan
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add test coverage
parent
1f7b881a
No related branches found
No related tags found
1 merge request
!5026
Issue #3096092: Make "path_alias" module optional
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/path_alias/tests/src/Functional/SiteInformationFormAlterTest.php
+77
-0
77 additions, 0 deletions
...ias/tests/src/Functional/SiteInformationFormAlterTest.php
with
77 additions
and
0 deletions
core/modules/path_alias/tests/src/Functional/SiteInformationFormAlterTest.php
0 → 100644
+
77
−
0
View file @
1d6b9c7e
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\Tests\path_alias\Functional
;
use
Drupal\node\NodeInterface
;
use
Drupal\Tests\BrowserTestBase
;
use
Drupal\Tests\Traits\Core\PathAliasTestTrait
;
/**
* Tests site information form alter functionality.
*
* @group path_alias
*/
class
SiteInformationFormAlterTest
extends
BrowserTestBase
{
use
PathAliasTestTrait
;
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'node'
,
'path_alias'
];
/**
* {@inheritdoc}
*/
protected
$defaultTheme
=
'stark'
;
/**
* The node that is created for testing.
*/
protected
NodeInterface
$node
;
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
// Create admin user, log in admin user, and create a node type.
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'access content'
,
'administer site configuration'
,
]));
$this
->
drupalCreateContentType
([
'type'
=>
'page'
]);
}
/**
* Tests form alter.
*/
public
function
testFormAlter
():
void
{
$node
=
$this
->
drupalCreateNode
();
$this
->
createPathAlias
(
'/node/'
.
$node
->
id
(),
'/foo'
);
// Configure site information.
$this
->
drupalGet
(
'admin/config/system/site-information'
);
$this
->
submitForm
([
'site_frontpage'
=>
'/foo'
,
'site_403'
=>
'/foo'
,
'site_404'
=>
'/foo'
,
],
'Save configuration'
);
$this
->
assertSession
()
->
pageTextContains
(
'The configuration options have been saved.'
);
// Check that the system paths has been saved.
$this
->
assertSame
(
'/node/1'
,
$this
->
config
(
'system.site'
)
->
get
(
'page.front'
));
$this
->
assertSame
(
'/node/1'
,
$this
->
config
(
'system.site'
)
->
get
(
'page.403'
));
$this
->
assertSame
(
'/node/1'
,
$this
->
config
(
'system.site'
)
->
get
(
'page.404'
));
// Check that only the front page path is converted to an alias.
$page
=
$this
->
getSession
()
->
getPage
();
$this
->
assertSame
(
'/foo'
,
$page
->
findField
(
'site_frontpage'
)
->
getValue
());
$this
->
assertSame
(
'/node/1'
,
$page
->
findField
(
'site_403'
)
->
getValue
());
$this
->
assertSame
(
'/node/1'
,
$page
->
findField
(
'site_404'
)
->
getValue
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment