Issue #2962088 by yogeshmpawar, jvsouto, Rassoni, Prashant.c, bhanuprakashnani, quietone, cilefen, longwave, drumm, smustgrave: Convert drupal.org to example.com in tests

merge-requests/3988/head
catch 2023-05-11 13:53:48 +01:00
parent 51021373a6
commit dd5a5b712e
15 changed files with 40 additions and 40 deletions

View File

@ -375,16 +375,16 @@ class MediaTest extends WebDriverTestBase {
// Wrap the existing drupal-media tag with a div and an a that include
// attributes allowed via GHS.
$original_value = $this->host->body->value;
$this->host->body->value = '<div data-bar="baz"><a href="https://drupal.org" data-foo="bar">' . $original_value . '</a></div>';
$this->host->body->value = '<div data-bar="baz"><a href="https://example.com" data-foo="bar">' . $original_value . '</a></div>';
$this->host->save();
$this->drupalGet($this->host->toUrl('edit-form'));
// Confirm data-foo is present in the editing view.
$this->assertNotEmpty($link = $assert_session->waitForElementVisible('css', 'a[href="https://drupal.org"]'));
$this->assertNotEmpty($link = $assert_session->waitForElementVisible('css', 'a[href="https://example.com"]'));
$this->assertEquals('bar', $link->getAttribute('data-foo'));
// Confirm that the media is wrapped by the div on the editing view.
$assert_session->elementExists('css', 'div[data-bar="baz"] > .drupal-media > a[href="https://drupal.org"] > div[data-drupal-media-preview]');
$assert_session->elementExists('css', 'div[data-bar="baz"] > .drupal-media > a[href="https://example.com"] > div[data-drupal-media-preview]');
// Confirm that drupal-media is wrapped by the div and a, and that GHS has
// retained arbitrary HTML allowed by source editing.
@ -638,12 +638,12 @@ class MediaTest extends WebDriverTestBase {
$this->pressEditorButton('Link');
$this->assertVisibleBalloon('.ck-link-form');
$link_input = $page->find('css', '.ck-balloon-panel .ck-link-form input[type=text]');
$link_input->setValue('https://drupal.org');
$link_input->setValue('https://example.com');
$page->find('css', '.ck-balloon-panel .ck-link-form button[type=submit]')->click();
$this->assertNotEmpty($assert_session->waitForElement('css', '.drupal-media figcaption > a'));
$this->assertEquals('<a class="ck-link_selected" href="https://drupal.org">Llamas are the most awesome ever</a>', $figcaption->getHtml());
$this->assertEquals('<a class="ck-link_selected" href="https://example.com">Llamas are the most awesome ever</a>', $figcaption->getHtml());
$editor_dom = $this->getEditorDataAsDom();
$this->assertEquals('<a href="https://drupal.org">Llamas are the most awesome ever</a>', $editor_dom->getElementsByTagName('drupal-media')->item(0)->getAttribute('data-caption'));
$this->assertEquals('<a href="https://example.com">Llamas are the most awesome ever</a>', $editor_dom->getElementsByTagName('drupal-media')->item(0)->getAttribute('data-caption'));
}
/**

View File

@ -327,7 +327,7 @@ abstract class JsonApiFunctionalTestBase extends BrowserTestBase {
// Make sure that there is at least 1 https link for ::testRead() #19.
$this->nodes[0]->field_link = [
'title' => 'Drupal',
'uri' => 'https://drupal.org',
'uri' => 'https://example.com',
];
$this->nodes[0]->save();
}

View File

@ -94,7 +94,7 @@ class LinkFieldUITest extends BrowserTestBase {
DRUPAL_OPTIONAL,
];
$link_types = [
LinkItemInterface::LINK_EXTERNAL => 'http://drupal.org',
LinkItemInterface::LINK_EXTERNAL => 'http://example.com',
LinkItemInterface::LINK_GENERIC => '',
LinkItemInterface::LINK_INTERNAL => '<front>',
];

View File

@ -70,7 +70,7 @@ class LinkViewsTokensTest extends ViewTestBase {
public function testLinkViewsTokens() {
// Array of URI's to test.
$uris = [
'http://www.drupal.org' => 'Drupal.org',
'http://www.example.com' => 'example.com',
];
// Add nodes with the URI's and titles.

View File

@ -67,12 +67,12 @@ class LinkFieldFormStatesTest extends WebDriverTestBase {
public function linkFieldFormStatesData() {
return [
'Fill uri, keep title empty' => [
'https://drupal.org',
'https://example.com',
'',
],
'Fill title, keep uri empty' => [
'',
'https://drupal.org',
'https://example.com',
],
];
}

View File

@ -53,8 +53,8 @@ class LinkExternalProtocolsConstraintValidatorTest extends UnitTestCase {
$data = [];
// Test allowed protocols.
$data[] = ['http://www.drupal.org', TRUE];
$data[] = ['https://www.drupal.org', TRUE];
$data[] = ['http://www.example.com', TRUE];
$data[] = ['https://www.example.com', TRUE];
// cSpell:disable-next-line
$data[] = ['magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C', TRUE];

View File

@ -103,7 +103,7 @@ class MenuLinkParentTest extends MigrateProcessTestCase {
// The parent ID does not for the following tests.
return [
'parent link external and could not be loaded' => [
'source_value' => [1, 'admin', 'http://drupal.org'],
'source_value' => [1, 'admin', 'http://example.com'],
],
'parent link path/menu name not passed' => [
'source_value' => [1, NULL, NULL],

View File

@ -163,7 +163,7 @@ trait CreateTestContentEntitiesTrait {
if ($entity_type_manager->hasDefinition('menu_link_content')) {
$menu_link = $entity_type_manager->getStorage('menu_link_content')->create([
'title' => 'post upgrade menu link',
'link' => ['uri' => 'http://www.drupal.org'],
'link' => ['uri' => 'http://www.example.com'],
'menu_name' => 'tools',
]);
$menu_link->save();

View File

@ -245,9 +245,9 @@ class ProjectReleaseTest extends UnitTestCase {
protected function getValidData(): array {
return [
'status' => 'published',
'release_link' => 'https://drupal.org/release-link',
'release_link' => 'https://example.com/release-link',
'version' => '8.0.0',
'download_link' => 'https://drupal.org/download-link',
'download_link' => 'https://example.com/download-link',
'core_compatibility_message' => 'This is compatible',
'date' => 1452229200,
'terms' => [

View File

@ -317,19 +317,19 @@ class FieldWebTest extends ViewTestBase {
// Tests the external flag.
// Switch on the external flag should output an external URL as well.
$id_field->options['alter']['external'] = TRUE;
$id_field->options['alter']['path'] = $path = 'www.drupal.org';
$id_field->options['alter']['path'] = $path = 'www.example.com';
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) {
return $id_field->theme($row);
});
$this->assertSubString($output, 'http://www.drupal.org');
$this->assertSubString($output, 'http://www.example.com');
// Setup a not external URL, which shouldn't lead to an external URL.
$id_field->options['alter']['external'] = FALSE;
$id_field->options['alter']['path'] = $path = 'www.drupal.org';
$id_field->options['alter']['path'] = $path = 'www.example.com';
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($id_field, $row) {
return $id_field->theme($row);
});
$this->assertNotSubString($output, 'http://www.drupal.org');
$this->assertNotSubString($output, 'http://www.example.com');
// Tests the transforming of the case setting.
$id_field->options['alter']['path'] = $path = $this->randomMachineName();

View File

@ -231,11 +231,11 @@ class DisplayTest extends ViewTestBase {
// Test more link with absolute URL.
$view->display_handler->setOption('link_display', 'custom_url');
$view->display_handler->setOption('link_url', 'http://drupal.org');
$view->display_handler->setOption('link_url', 'http://example.com');
$this->executeView($view);
$output = $view->preview();
$output = $renderer->renderRoot($output);
$this->assertStringContainsString('http://drupal.org', $output, 'The read more link with href "http://drupal.org" was found.');
$this->assertStringContainsString('http://example.com', $output, 'The read more link with href "http://example.com" was found.');
// Test more link with query parameters in the URL.
$view->display_handler->setOption('link_display', 'custom_url');

View File

@ -288,9 +288,9 @@ class FieldPluginBaseTest extends UnitTestCase {
$data[] = ['<front>', '/%3Cfront%3E'];
// External URL.
$data[] = ['https://www.drupal.org', 'https://www.drupal.org'];
$data[] = ['http://www.drupal.org', 'http://www.drupal.org'];
$data[] = ['www.drupal.org', '/www.drupal.org'];
$data[] = ['https://www.example.com', 'https://www.example.com'];
$data[] = ['http://www.example.com', 'http://www.example.com'];
$data[] = ['www.example.com', '/www.example.com'];
return $data;
}
@ -379,8 +379,8 @@ class FieldPluginBaseTest extends UnitTestCase {
$data[] = ['test-path', ['suffix' => 'test_suffix'], '<a href="/test-path">value</a>', '<a href="/test-path">value</a>test_suffix'];
// External URL.
$data[] = ['https://www.drupal.org', [], [], '<a href="https://www.drupal.org">value</a>'];
$data[] = ['www.drupal.org', ['external' => TRUE], [], '<a href="http://www.drupal.org">value</a>'];
$data[] = ['https://www.example.com', [], [], '<a href="https://www.example.com">value</a>'];
$data[] = ['www.example.com', ['external' => TRUE], [], '<a href="http://www.example.com">value</a>'];
$data[] = ['', ['external' => TRUE], [], 'value'];
return $data;
@ -636,7 +636,7 @@ class FieldPluginBaseTest extends UnitTestCase {
public function providerTestRenderAsExternalLinkWithPathAndTokens() {
$data = [];
$data[] = ['{{ foo }}', ['{{ foo }}' => 'http://www.drupal.org'], '<a href="http://www.drupal.org">value</a>', ['context_path' => 'http://www.drupal.org']];
$data[] = ['{{ foo }}', ['{{ foo }}' => 'http://www.example.com'], '<a href="http://www.example.com">value</a>', ['context_path' => 'http://www.example.com']];
$data[] = ['{{ foo }}', ['{{ foo }}' => ''], 'value', ['context_path' => '']];
$data[] = ['{{ foo }}', ['{{ foo }}' => ''], 'value', ['context_path' => '', 'alter' => ['external' => TRUE]]];
$data[] = ['{{ foo }}', ['{{ foo }}' => '/test-path/123'], '<a href="/test-path/123">value</a>', ['context_path' => '/test-path/123']];
@ -777,7 +777,7 @@ class FieldPluginBaseTestField extends FieldPluginBase {
}
// @todo Remove as part of https://www.drupal.org/node/2529170.
// @todo Remove as part of https://www.example.com/node/2529170.
namespace Drupal\views\Plugin\views\field;
if (!function_exists('base_path')) {

View File

@ -430,14 +430,14 @@ class UrlHelperTest extends TestCase {
['https://example.com/external/path', TRUE],
['javascript://fake-external-path', FALSE],
// External URL without an explicit protocol.
['//www.drupal.org/foo/bar?foo=bar&bar=baz&baz#foo', TRUE],
['//www.example.com/foo/bar?foo=bar&bar=baz&baz#foo', TRUE],
// Internal URL starting with a slash.
['/www.drupal.org', FALSE],
['/www.example.com', FALSE],
// Simple external URLs.
['http://example.com', TRUE],
['https://example.com', TRUE],
['http://drupal.org/foo/bar?foo=bar&bar=baz&baz#foo', TRUE],
['//drupal.org', TRUE],
['http://example.com/foo/bar?foo=bar&bar=baz&baz#foo', TRUE],
['//example.com', TRUE],
// Some browsers ignore or strip leading control characters.
["\x00//www.example.com", TRUE],
["\x08//www.example.com", TRUE],
@ -455,7 +455,7 @@ class UrlHelperTest extends TestCase {
['/system/ajax', FALSE],
['?q=foo:bar', FALSE],
['node/edit:me', FALSE],
['/drupal.org', FALSE],
['/example.com', FALSE],
['<front>', FALSE],
];
}

View File

@ -67,8 +67,8 @@ class LogMessageParserTest extends UnitTestCase {
// Test removal of unexpected placeholders like ! while allowed
// placeholders beginning with @, % and : are preserved.
[
['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://drupal.org', '!bang' => 'foo bar']],
['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://drupal.org']],
['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://example.com', '!bang' => 'foo bar']],
['message' => 'Test placeholder with :url and old !bang parameter', 'context' => [':url' => 'https://example.com']],
],
];
}

View File

@ -64,8 +64,8 @@ class PrimitiveTypeConstraintValidatorTest extends UnitTestCase {
// It is odd that 1 is a valid string.
// $data[] = [$this->createMock('Drupal\Core\TypedData\Type\StringInterface'), 1, FALSE];
$data[] = [new StringData(DataDefinition::create('string')), [], FALSE];
$data[] = [new Uri(DataDefinition::create('uri')), 'http://www.drupal.org', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'https://www.drupal.org', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'http://www.example.com', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'https://www.example.com', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'Invalid', FALSE];
$data[] = [new Uri(DataDefinition::create('uri')), 'entity:node/1', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'base:', TRUE];
@ -75,7 +75,7 @@ class PrimitiveTypeConstraintValidatorTest extends UnitTestCase {
$data[] = [new Uri(DataDefinition::create('uri')), 'public://foo.png', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'private://', FALSE];
$data[] = [new Uri(DataDefinition::create('uri')), 'private://foo.png', TRUE];
$data[] = [new Uri(DataDefinition::create('uri')), 'drupal.org', FALSE];
$data[] = [new Uri(DataDefinition::create('uri')), 'example.com', FALSE];
return $data;
}