Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
domain_unique_path_alias
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
domain_unique_path_alias
Merge requests
!5
fix php-unit
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix php-unit
s1933/fix-phpunit
into
1.x
Overview
0
Commits
1
Pipelines
21
Changes
5
Merged
Jean-Philippe Déis Nuel
requested to merge
s1933/fix-phpunit
into
1.x
7 months ago
Overview
0
Commits
1
Pipelines
21
Changes
3
Expand
0
0
Merge request reports
Compare
version 9
version 18
1a8fc598
7 months ago
version 17
1d6efb16
7 months ago
version 16
a5d7e76e
7 months ago
version 15
2d829c38
7 months ago
version 14
4a2689dc
7 months ago
version 13
95a8edd7
7 months ago
version 12
5dabce1d
7 months ago
version 11
8fa33014
7 months ago
version 10
b34c15e1
7 months ago
version 9
da609cc8
7 months ago
version 8
c0d5bbc7
7 months ago
version 7
34c27b18
7 months ago
version 6
c6961ee7
7 months ago
version 5
e1ff5b05
7 months ago
version 4
110397cb
7 months ago
version 3
2f8c6351
7 months ago
version 2
c6b668db
7 months ago
version 1
d83a9efc
7 months ago
1.x (base)
and
latest version
latest version
c964c03e
1 commit,
7 months ago
version 18
1a8fc598
1 commit,
7 months ago
version 17
1d6efb16
1 commit,
7 months ago
version 16
a5d7e76e
1 commit,
7 months ago
version 15
2d829c38
1 commit,
7 months ago
version 14
4a2689dc
1 commit,
7 months ago
version 13
95a8edd7
1 commit,
7 months ago
version 12
5dabce1d
1 commit,
7 months ago
version 11
8fa33014
1 commit,
7 months ago
version 10
b34c15e1
1 commit,
7 months ago
version 9
da609cc8
1 commit,
7 months ago
version 8
c0d5bbc7
1 commit,
7 months ago
version 7
34c27b18
1 commit,
7 months ago
version 6
c6961ee7
1 commit,
7 months ago
version 5
e1ff5b05
1 commit,
7 months ago
version 4
110397cb
1 commit,
7 months ago
version 3
2f8c6351
1 commit,
7 months ago
version 2
c6b668db
1 commit,
7 months ago
version 1
d83a9efc
1 commit,
7 months ago
Show latest version
3 files
+
95
−
30
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
tests/src/Functional/DomainUniquePathAliasTest.php
+
84
−
29
Options
@@ -2,26 +2,34 @@
namespace
Drupal\Tests\domain_unique_path_alias\Functional
;
use
Drupal\Tests\BrowserTestBase
;
use
Drupal\domain_access
\DomainAccessManagerInterface
;
use
Drupal\domain_source
\DomainSourceElementManagerInterface
;
use
Drupal\Tests\domain\Functional\DomainTestBase
;
/**
* Tests
the Address field translatability
.
* Tests
path alias on different domains
.
*
* @group domain
* @group domain
_unique_path_alias
*/
class
DomainUniquePathAliasTest
extends
Browser
TestBase
{
class
DomainUniquePathAliasTest
extends
Domain
TestBase
{
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'node'
,
];
protected
$defaultTheme
=
'stark'
;
/**
* {@inheritdoc}
*/
protected
$defaultTheme
=
'stark'
;
protected
static
$modules
=
[
'domain'
,
'domain_access'
,
'domain_source'
,
'field'
,
'node'
,
'path_alias'
,
'pathauto'
,
];
/**
* {@inheritdoc}
@@ -29,36 +37,83 @@ class DomainUniquePathAliasTest extends BrowserTestBase {
protected
function
setUp
():
void
{
parent
::
setUp
();
// Create
the "Basic page" node type
.
$this
->
drupalCreateContentType
(
[
'
type'
=>
'page
'
,
'
name'
=>
'Basic page
'
,
// Create
2 domains
.
DomainTestBase
::
domainCreateTestDomains
(
2
,
'example.com'
,
[
'
domain
'
,
'
domain1
'
,
]);
// Create some languages.
ConfigurableLanguage
::
create
([
'id'
=>
'fr'
])
->
save
();
ConfigurableLanguage
::
create
([
'id'
=>
'it'
])
->
save
();
$domains
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'domain'
)
->
loadMultiple
();
// Create the address field on the "Basic page" node type.
$field_storage
=
FieldStorageConfig
::
create
([
'field_name'
=>
'field_address'
,
'entity_type'
=>
'node'
,
'type'
=>
'address'
,
// Create an article on example_com domain.
$this
->
drupalCreateNode
([
'type'
=>
'article'
,
'path'
=>
[
'alias'
=>
'/contact'
,
],
DomainAccessManagerInterface
::
DOMAIN_ACCESS_FIELD
=>
[
$domains
[
'example_com'
]
->
id
(),
],
DomainSourceElementManagerInterface
::
DOMAIN_SOURCE_FIELD
=>
[
$domains
[
'example_com'
]
->
id
(),
],
]);
$field_storage
->
save
();
$field
=
FieldConfig
::
create
([
'field_storage'
=>
$field_storage
,
'bundle'
=>
'page'
,
'label'
=>
'Address'
,
// Create an article on example_com domain.
$this
->
drupalCreateNode
([
'type'
=>
'article'
,
'path'
=>
[
'alias'
=>
'/contact-bis'
,
],
DomainAccessManagerInterface
::
DOMAIN_ACCESS_FIELD
=>
[
$domains
[
'example_com'
]
->
id
(),
],
DomainSourceElementManagerInterface
::
DOMAIN_SOURCE_FIELD
=>
[
$domains
[
'example_com'
]
->
id
(),
],
]);
// Create an article on domain1_example_com domain.
$this
->
drupalCreateNode
([
'type'
=>
'article'
,
'path'
=>
[
'alias'
=>
'/contact'
,
],
DomainAccessManagerInterface
::
DOMAIN_ACCESS_FIELD
=>
[
$domains
[
'domain1_example_com'
]
->
id
(),
],
DomainSourceElementManagerInterface
::
DOMAIN_SOURCE_FIELD
=>
[
$domains
[
'domain1_example_com'
]
->
id
(),
],
]);
$field
->
save
();
}
/**
*
Tests synced addr
ess
fields on translated nod
es.
*
Creates a node and t
es
t
s
the creation of node access rul
es.
*/
public
function
testSyncedAddressFields
()
{
$user
=
$this
->
drupalCreateUser
([],
NULL
,
TRUE
);
public
function
testDomainUniquePathAlias
()
{
$this
->
drupalLogin
(
$this
->
rootUser
);
$this
->
drupalGet
(
'admin/content'
);
$this
->
assertSession
()
->
responseContains
(
'<a href="http://example.com/web/contact" hreflang="en">'
);
$this
->
assertSession
()
->
responseContains
(
'<a href="http://example.com/web/contact-bis" hreflang="en">'
);
$this
->
assertSession
()
->
responseContains
(
'<a href="http://domain1.example.com/web/contact" hreflang="en">'
);
$constraint_message
=
'The alias /contact is already in use in this language.'
;
$edit
=
[
'path[0][alias]'
=>
'/contact-bis-bis'
,
];
$this
->
drupalGet
(
'node/2/edit'
);
$this
->
submitForm
(
$edit
,
'Save'
);
$this
->
assertSession
()
->
pageTextNotContains
(
$constraint_message
);
$edit
=
[
'path[0][alias]'
=>
'/contact'
,
];
$this
->
drupalGet
(
'node/2/edit'
);
$this
->
submitForm
(
$edit
,
'Save'
);
$this
->
assertSession
()
->
pageTextContains
(
$constraint_message
);
}
}
Loading