Loading core/modules/link/tests/src/Functional/LinkFieldTest.php +20 −6 Original line number Diff line number Diff line Loading @@ -68,10 +68,24 @@ protected function setUp(): void { ])); } /** * Tests the functionality and rendering of the link field. * * This is being as one to avoid multiple Drupal install. */ public function testLinkField() { $this->doTestURLValidation(); $this->doTestLinkTitle(); $this->doTestLinkFormatter(); $this->doTestLinkSeparateFormatter(); $this->doTestEditNonNodeEntityLink(); $this->doTestLinkTypeOnLinkWidget(); } /** * Tests link field URL validation. */ public function testURLValidation() { protected function doTestURLValidation() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -255,7 +269,7 @@ protected function assertInvalidEntries(string $field_name, array $invalid_entri /** * Tests the link title settings of a link field. */ public function testLinkTitle() { protected function doTestLinkTitle() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -380,7 +394,7 @@ public function testLinkTitle() { /** * Tests the default 'link' formatter. */ public function testLinkFormatter() { protected function doTestLinkFormatter() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -537,7 +551,7 @@ public function testLinkFormatter() { * This test is mostly the same as testLinkFormatter(), but they cannot be * merged, since they involve different configuration and output. */ public function testLinkSeparateFormatter() { protected function doTestLinkSeparateFormatter() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -664,7 +678,7 @@ public function testLinkSeparateFormatter() { * a link and also which LinkItemInterface::LINK_* is (EXTERNAL, GENERIC, * INTERNAL). */ public function testLinkTypeOnLinkWidget() { protected function doTestLinkTypeOnLinkWidget() { $link_type = LinkItemInterface::LINK_EXTERNAL; $field_name = mb_strtolower($this->randomMachineName()); Loading Loading @@ -702,7 +716,7 @@ public function testLinkTypeOnLinkWidget() { /** * Tests editing a link to a non-node entity. */ public function testEditNonNodeEntityLink() { protected function doTestEditNonNodeEntityLink() { $entity_type_manager = \Drupal::entityTypeManager(); $entity_test_storage = $entity_type_manager->getStorage('entity_test'); Loading Loading
core/modules/link/tests/src/Functional/LinkFieldTest.php +20 −6 Original line number Diff line number Diff line Loading @@ -68,10 +68,24 @@ protected function setUp(): void { ])); } /** * Tests the functionality and rendering of the link field. * * This is being as one to avoid multiple Drupal install. */ public function testLinkField() { $this->doTestURLValidation(); $this->doTestLinkTitle(); $this->doTestLinkFormatter(); $this->doTestLinkSeparateFormatter(); $this->doTestEditNonNodeEntityLink(); $this->doTestLinkTypeOnLinkWidget(); } /** * Tests link field URL validation. */ public function testURLValidation() { protected function doTestURLValidation() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -255,7 +269,7 @@ protected function assertInvalidEntries(string $field_name, array $invalid_entri /** * Tests the link title settings of a link field. */ public function testLinkTitle() { protected function doTestLinkTitle() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -380,7 +394,7 @@ public function testLinkTitle() { /** * Tests the default 'link' formatter. */ public function testLinkFormatter() { protected function doTestLinkFormatter() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -537,7 +551,7 @@ public function testLinkFormatter() { * This test is mostly the same as testLinkFormatter(), but they cannot be * merged, since they involve different configuration and output. */ public function testLinkSeparateFormatter() { protected function doTestLinkSeparateFormatter() { $field_name = mb_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = FieldStorageConfig::create([ Loading Loading @@ -664,7 +678,7 @@ public function testLinkSeparateFormatter() { * a link and also which LinkItemInterface::LINK_* is (EXTERNAL, GENERIC, * INTERNAL). */ public function testLinkTypeOnLinkWidget() { protected function doTestLinkTypeOnLinkWidget() { $link_type = LinkItemInterface::LINK_EXTERNAL; $field_name = mb_strtolower($this->randomMachineName()); Loading Loading @@ -702,7 +716,7 @@ public function testLinkTypeOnLinkWidget() { /** * Tests editing a link to a non-node entity. */ public function testEditNonNodeEntityLink() { protected function doTestEditNonNodeEntityLink() { $entity_type_manager = \Drupal::entityTypeManager(); $entity_test_storage = $entity_type_manager->getStorage('entity_test'); Loading