Loading core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php +14 −20 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ * Tests the creation of telephone fields. * * @group telephone * @group #slow */ class TelephoneFieldTest extends BrowserTestBase { Loading Loading @@ -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 providerPhoneNumbers() { return [ public function testTelephoneFormatter(): void { $phone_numbers = [ 'standard phone number' => ['123456789', '123456789'], 'whitespace is removed' => ['1234 56789', '123456789'], 'parse_url(0) return FALSE workaround' => ['0', '0-'], Loading @@ -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 . '">'); } } } Loading
core/modules/telephone/tests/src/Functional/TelephoneFieldTest.php +14 −20 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ * Tests the creation of telephone fields. * * @group telephone * @group #slow */ class TelephoneFieldTest extends BrowserTestBase { Loading Loading @@ -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 providerPhoneNumbers() { return [ public function testTelephoneFormatter(): void { $phone_numbers = [ 'standard phone number' => ['123456789', '123456789'], 'whitespace is removed' => ['1234 56789', '123456789'], 'parse_url(0) return FALSE workaround' => ['0', '0-'], Loading @@ -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 . '">'); } } }