Skip to content
Snippets Groups Projects
Verified Commit 87b8c59a authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3462549 by catch, ankitv18: Optimize TelephoneFieldTest

(cherry picked from commit c0e94e34)
parent 696b56be
No related branches found
No related tags found
18 merge requests!10663Issue #3495778: Update phpdoc in FileSaveHtaccessLoggingTest,!10451Issue #3472458 by watergate, smustgrave: CKEditor 5 show blocks label is not translated,!103032838547 Fix punctuation rules for inline label suffix colon with CSS only,!10150Issue #3467294 by quietone, nod_, smustgrave, catch, longwave: Change string...,!10130Resolve #3480321 "Second level menu",!9936Issue #3483087: Check the module:// prefix in the translation server path and replace it with the actual module path,!9933Issue #3394728 by ankondrat4: Undefined array key "#prefix" and deprecated function: explode() in Drupal\file\Element\ManagedFile::uploadAjaxCallback(),!9914Issue #3451136 by quietone, gapple, ghost of drupal past: Improve...,!9882Draft: Issue #3481777 In bulk_form ensure the triggering element is the bulk_form button,!9839Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9815Issue #3480025: There is no way to remove entity cache items,!9757Issue #3478869 Add "All" or overview links to parent links,!9752Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9749Issue #3439910 by pooja_sharma, vensires: Fix Toolbar tests that rely on UID1's super user behavior,!9678Issue #3465132 by catch, Spokje, nod_: Show test run time by class in run-tests.sh output,!9578Issue #3304746 by scott_euser, casey, smustgrave: BigPipe cannot handle (GET)...,!9449Issue #3344041: Allow textarea widgets to be used for text (formatted) fields,!8945🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥...
Pipeline #234389 passed
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* Tests the creation of telephone fields. * Tests the creation of telephone fields.
* *
* @group telephone * @group telephone
* @group #slow
*/ */
class TelephoneFieldTest extends BrowserTestBase { class TelephoneFieldTest extends BrowserTestBase {
...@@ -101,26 +100,9 @@ public function testTelephoneWidget(): void { ...@@ -101,26 +100,9 @@ public function testTelephoneWidget(): void {
* Tests the telephone formatter. * Tests the telephone formatter.
* *
* @covers \Drupal\telephone\Plugin\Field\FieldFormatter\TelephoneLinkFormatter::viewElements * @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 providerPhoneNumbers() { public function testTelephoneFormatter(): void {
return [ $phone_numbers = [
'standard phone number' => ['123456789', '123456789'], 'standard phone number' => ['123456789', '123456789'],
'whitespace is removed' => ['1234 56789', '123456789'], 'whitespace is removed' => ['1234 56789', '123456789'],
'parse_url(0) return FALSE workaround' => ['0', '0-'], 'parse_url(0) return FALSE workaround' => ['0', '0-'],
...@@ -133,6 +115,18 @@ public static function providerPhoneNumbers() { ...@@ -133,6 +115,18 @@ public static function providerPhoneNumbers() {
'php bug 70588 workaround - invalid port number - upper edge check' => ['99999', '9-9999'], 'php bug 70588 workaround - invalid port number - upper edge check' => ['99999', '9-9999'],
'lowest number not affected by php bug 70588' => ['100000', '100000'], '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 . '">');
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment