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
9e73b2b3
Verified
Commit
9e73b2b3
authored
8 months ago
by
Théodore Biadala
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3462549
by catch, ankitv18: Optimize TelephoneFieldTest
(cherry picked from commit
c0e94e34
)
parent
fd1bcbe5
No related branches found
No related tags found
2 merge requests
!11185
Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4
,
!9944
Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline
#234754
passed
8 months ago
Stage: 🏗️ Build
Stage: 🪄 Lint
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php
+14
-20
14 additions, 20 deletions
...les/telephone/tests/src/Functional/TelephoneFieldTest.php
with
14 additions
and
20 deletions
core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php
+
14
−
20
View file @
9e73b2b3
...
...
@@ -13,7 +13,6 @@
* Tests the creation of telephone fields.
*
* @group telephone
* @group #slow
*/
class
TelephoneFieldTest
extends
BrowserTestBase
{
...
...
@@ -101,26 +100,9 @@ public function testTelephoneWidget(): void {
* Tests the telephone formatter.
*
* @covers \Drupal\telephone\Plugin\Field\FieldFormatter\TelephoneLinkFormatter::viewElements
*
* @dataProvider providerPhoneNumbers
*/
public
function
testTelephoneFormatter
(
$input
,
$expected
):
void
{
// Test basic entry of telephone field.
$edit
=
[
'title[0][value]'
=>
$this
->
randomMachineName
(),
'field_telephone[0][value]'
=>
$input
,
];
$this
->
drupalGet
(
'node/add/article'
);
$this
->
submitForm
(
$edit
,
'Save'
);
$this
->
assertSession
()
->
responseContains
(
'<a href="tel:'
.
$expected
.
'">'
);
}
/**
* Provides the phone numbers to check and expected results.
*/
public
static
function
providerPhoneNumb
er
s
()
{
return
[
public
function
testTelephoneFormatt
er
()
:
void
{
$phone_numbers
=
[
'standard phone number'
=>
[
'123456789'
,
'123456789'
],
'whitespace is removed'
=>
[
'1234 56789'
,
'123456789'
],
'parse_url(0) return FALSE workaround'
=>
[
'0'
,
'0-'
],
...
...
@@ -133,6 +115,18 @@ public static function providerPhoneNumbers() {
'php bug 70588 workaround - invalid port number - upper edge check'
=>
[
'99999'
,
'9-9999'
],
'lowest number not affected by php bug 70588'
=>
[
'100000'
,
'100000'
],
];
foreach
(
$phone_numbers
as
$data
)
{
[
$input
,
$expected
]
=
$data
;
// Test basic entry of telephone field.
$edit
=
[
'title[0][value]'
=>
$this
->
randomMachineName
(),
'field_telephone[0][value]'
=>
$input
,
];
$this
->
drupalGet
(
'node/add/article'
);
$this
->
submitForm
(
$edit
,
'Save'
);
$this
->
assertSession
()
->
responseContains
(
'<a href="tel:'
.
$expected
.
'">'
);
}
}
}
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