comparison core/modules/link/tests/src/Functional/LinkFieldTest.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
119 // Front page, with query string and fragment. 119 // Front page, with query string and fragment.
120 '/' => '<front>', 120 '/' => '<front>',
121 '/?example=llama' => '<front>?example=llama', 121 '/?example=llama' => '<front>?example=llama',
122 '/#example' => '<front>#example', 122 '/#example' => '<front>#example',
123 123
124 // Trailing spaces should be ignored.
125 '/ ' => '<front>',
126 '/path with spaces ' => '/path with spaces',
127
124 // @todo '<front>' is valid input for BC reasons, may be removed by 128 // @todo '<front>' is valid input for BC reasons, may be removed by
125 // https://www.drupal.org/node/2421941 129 // https://www.drupal.org/node/2421941
126 '<front>' => '&lt;front&gt;', 130 '<front>' => '&lt;front&gt;',
127 '<front>#example' => '&lt;front&gt;#example', 131 '<front>#example' => '&lt;front&gt;#example',
128 '<front>?example=llama' => '&lt;front&gt;?example=llama', 132 '<front>?example=llama' => '&lt;front&gt;?example=llama',
198 ]; 202 ];
199 $this->drupalPostForm('entity_test/add', $edit, t('Save')); 203 $this->drupalPostForm('entity_test/add', $edit, t('Save'));
200 preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); 204 preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
201 $id = $match[1]; 205 $id = $match[1];
202 $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); 206 $this->assertText(t('entity_test @id has been created.', ['@id' => $id]));
203 $this->assertRaw($string); 207 $this->assertRaw('"' . $string . '"');
204 } 208 }
205 } 209 }
206 210
207 /** 211 /**
208 * Asserts that invalid URLs cannot be submitted. 212 * Asserts that invalid URLs cannot be submitted.
279 } 283 }
280 else { 284 else {
281 $this->assertRaw('placeholder="Enter the text for this link"'); 285 $this->assertRaw('placeholder="Enter the text for this link"');
282 286
283 $this->assertFieldByName("{$field_name}[0][title]", '', 'Link text field found.'); 287 $this->assertFieldByName("{$field_name}[0][title]", '', 'Link text field found.');
288 if ($title_setting === DRUPAL_OPTIONAL) {
289 // Verify that the URL is required, if the link text is non-empty.
290 $edit = [
291 "{$field_name}[0][title]" => 'Example',
292 ];
293 $this->drupalPostForm(NULL, $edit, t('Save'));
294 $this->assertText(t('The URL field is required when the @title field is specified.', ['@title' => t('Link text')]));
295 }
284 if ($title_setting === DRUPAL_REQUIRED) { 296 if ($title_setting === DRUPAL_REQUIRED) {
285 // Verify that the link text is required, if the URL is non-empty. 297 // Verify that the link text is required, if the URL is non-empty.
286 $edit = [ 298 $edit = [
287 "{$field_name}[0][uri]" => 'http://www.example.com', 299 "{$field_name}[0][uri]" => 'http://www.example.com',
288 ]; 300 ];