Skip to content

Commit e3fc5d9

Browse files
author
Nathaniel Catchpole
committed
Issue #3031580 by alexpott, Gábor Hojtsy, Lendude, catch, jibran, dawehner, Berdir: Undeprecate \Drupal\FunctionalTests\AssertLegacyTrait and \Drupal\KernelTests\AssertLegacyTrait in Drupal 8
1 parent 6b6b5b0 commit e3fc5d9

File tree

2 files changed

+60
-51
lines changed

2 files changed

+60
-51
lines changed

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
2+
// @codingStandardsIgnoreFile
33
namespace Drupal\FunctionalTests;
44

55
use Behat\Mink\Element\NodeElement;
@@ -12,11 +12,16 @@
1212
/**
1313
* Provides convenience methods for assertions in browser tests.
1414
*
15-
* @deprecated Scheduled for removal in Drupal 9.0.0. Use the methods on
15+
* Deprecated Scheduled for removal in Drupal 10.0.0. Use the methods on
1616
* \Drupal\Tests\WebAssert instead, for example
1717
* @code
1818
* $this->assertSession()->statusCodeEquals(200);
1919
* @endcode
20+
*
21+
* @todo https://www.drupal.org/project/drupal/issues/3031580 Note that
22+
* deprecations in this file do not use the @ symbol in Drupal 8 because this
23+
* will be removed in Drupal 10.0.0. Adding the @ back should re-enable coding
24+
* stanadrds checks.
2025
*/
2126
trait AssertLegacyTrait {
2227

@@ -28,7 +33,7 @@ trait AssertLegacyTrait {
2833
* @param string $css_selector
2934
* The CSS selector identifying the element to check.
3035
*
31-
* @deprecated Scheduled for removal in Drupal 9.0.0.
36+
* Deprecated Scheduled for removal in Drupal 10.0.0.
3237
* Use $this->assertSession()->elementExists() instead.
3338
*/
3439
protected function assertElementPresent($css_selector) {
@@ -41,7 +46,7 @@ protected function assertElementPresent($css_selector) {
4146
* @param string $css_selector
4247
* The CSS selector identifying the element to check.
4348
*
44-
* @deprecated Scheduled for removal in Drupal 9.0.0.
49+
* Deprecated Scheduled for removal in Drupal 10.0.0.
4550
* Use $this->assertSession()->elementNotExists() instead.
4651
*/
4752
protected function assertElementNotPresent($css_selector) {
@@ -57,7 +62,7 @@ protected function assertElementNotPresent($css_selector) {
5762
* @param string $text
5863
* Plain text to look for.
5964
*
60-
* @deprecated Scheduled for removal in Drupal 9.0.0.
65+
* Deprecated Scheduled for removal in Drupal 10.0.0.
6166
* Use instead:
6267
* - $this->assertSession()->responseContains() for non-HTML responses,
6368
* like XML or Json.
@@ -89,7 +94,7 @@ protected function assertText($text) {
8994
* @param string $text
9095
* Plain text to look for.
9196
*
92-
* @deprecated Scheduled for removal in Drupal 9.0.0.
97+
* Deprecated Scheduled for removal in Drupal 10.0.0.
9398
* Use instead:
9499
* - $this->assertSession()->responseNotContains() for non-HTML responses,
95100
* like XML or Json.
@@ -155,7 +160,7 @@ protected function assertTextHelper($text, $not_exists = TRUE) {
155160
* (optional) A message to display with the assertion. Do not translate
156161
* messages with t(). If left blank, a default message will be displayed.
157162
*
158-
* @deprecated Scheduled for removal in Drupal 9.0.0.
163+
* Deprecated Scheduled for removal in Drupal 10.0.0.
159164
* Use $this->getSession()->getPage()->getText() and substr_count() instead.
160165
*/
161166
protected function assertUniqueText($text, $message = NULL) {
@@ -181,7 +186,7 @@ protected function assertUniqueText($text, $message = NULL) {
181186
* (optional) A message to display with the assertion. Do not translate
182187
* messages with t(). If left blank, a default message will be displayed.
183188
*
184-
* @deprecated Scheduled for removal in Drupal 9.0.0.
189+
* Deprecated Scheduled for removal in Drupal 10.0.0.
185190
* Use $this->getSession()->getPage()->getText() and substr_count() instead.
186191
*/
187192
protected function assertNoUniqueText($text, $message = '') {
@@ -201,7 +206,7 @@ protected function assertNoUniqueText($text, $message = '') {
201206
* Response code. For example 200 is a successful page request. For a list
202207
* of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
203208
*
204-
* @deprecated Scheduled for removal in Drupal 9.0.0.
209+
* Deprecated Scheduled for removal in Drupal 10.0.0.
205210
* Use $this->assertSession()->statusCodeEquals() instead.
206211
*/
207212
protected function assertResponse($code) {
@@ -218,7 +223,7 @@ protected function assertResponse($code) {
218223
* to skip checking the actual value, while still checking that the field
219224
* exists.
220225
*
221-
* @deprecated Scheduled for removal in Drupal 9.0.0.
226+
* Deprecated Scheduled for removal in Drupal 10.0.0.
222227
* Use $this->assertSession()->fieldExists() or
223228
* $this->assertSession()->buttonExists() or
224229
* $this->assertSession()->fieldValueEquals() instead.
@@ -238,7 +243,7 @@ protected function assertFieldByName($name, $value = NULL) {
238243
* value, while still checking that the field does not exist. However, the
239244
* default value ('') asserts that the field value is not an empty string.
240245
*
241-
* @deprecated Scheduled for removal in Drupal 9.0.0.
246+
* Deprecated Scheduled for removal in Drupal 10.0.0.
242247
* Use $this->assertSession()->fieldNotExists() or
243248
* $this->assertSession()->buttonNotExists() or
244249
* $this->assertSession()->fieldValueNotEquals() instead.
@@ -260,7 +265,7 @@ protected function assertNoFieldByName($name, $value = '') {
260265
*
261266
* @throws \Behat\Mink\Exception\ElementNotFoundException
262267
*
263-
* @deprecated Scheduled for removal in Drupal 9.0.0.
268+
* Deprecated Scheduled for removal in Drupal 10.0.0.
264269
* Use $this->assertSession()->fieldExists() or
265270
* $this->assertSession()->buttonExists() or
266271
* $this->assertSession()->fieldValueEquals() instead.
@@ -275,7 +280,7 @@ protected function assertFieldById($id, $value = '') {
275280
* @param string $field
276281
* Name or ID of field to assert.
277282
*
278-
* @deprecated Scheduled for removal in Drupal 9.0.0.
283+
* Deprecated Scheduled for removal in Drupal 10.0.0.
279284
* Use $this->assertSession()->fieldExists() or
280285
* $this->assertSession()->buttonExists() instead.
281286
*/
@@ -289,7 +294,7 @@ protected function assertField($field) {
289294
* @param string $field
290295
* Name or ID of field to assert.
291296
*
292-
* @deprecated Scheduled for removal in Drupal 9.0.0.
297+
* Deprecated Scheduled for removal in Drupal 10.0.0.
293298
* Use $this->assertSession()->fieldNotExists() or
294299
* $this->assertSession()->buttonNotExists() instead.
295300
*/
@@ -305,7 +310,7 @@ protected function assertNoField($field) {
305310
* @param string $raw
306311
* Raw (HTML) string to look for.
307312
*
308-
* @deprecated Scheduled for removal in Drupal 9.0.0.
313+
* Deprecated Scheduled for removal in Drupal 10.0.0.
309314
* Use $this->assertSession()->responseContains() instead.
310315
*/
311316
protected function assertRaw($raw) {
@@ -320,7 +325,7 @@ protected function assertRaw($raw) {
320325
* @param string $raw
321326
* Raw (HTML) string to look for.
322327
*
323-
* @deprecated Scheduled for removal in Drupal 9.0.0.
328+
* Deprecated Scheduled for removal in Drupal 10.0.0.
324329
* Use $this->assertSession()->responseNotContains() instead.
325330
*/
326331
protected function assertNoRaw($raw) {
@@ -333,7 +338,7 @@ protected function assertNoRaw($raw) {
333338
* @param string $expected_title
334339
* The string the page title should be.
335340
*
336-
* @deprecated Scheduled for removal in Drupal 9.0.0.
341+
* Deprecated Scheduled for removal in Drupal 10.0.0.
337342
* Use $this->assertSession()->titleEquals() instead.
338343
*/
339344
protected function assertTitle($expected_title) {
@@ -352,7 +357,7 @@ protected function assertTitle($expected_title) {
352357
* @param int $index
353358
* Link position counting from zero.
354359
*
355-
* @deprecated Scheduled for removal in Drupal 9.0.0.
360+
* Deprecated Scheduled for removal in Drupal 10.0.0.
356361
* Use $this->assertSession()->linkExists() instead.
357362
*/
358363
protected function assertLink($label, $index = 0) {
@@ -365,7 +370,7 @@ protected function assertLink($label, $index = 0) {
365370
* @param string|\Drupal\Component\Render\MarkupInterface $label
366371
* Text between the anchor tags.
367372
*
368-
* @deprecated Scheduled for removal in Drupal 9.0.0.
373+
* Deprecated Scheduled for removal in Drupal 10.0.0.
369374
* Use $this->assertSession()->linkNotExists() instead.
370375
*/
371376
protected function assertNoLink($label) {
@@ -380,7 +385,7 @@ protected function assertNoLink($label) {
380385
* @param int $index
381386
* Link position counting from zero.
382387
*
383-
* @deprecated Scheduled for removal in Drupal 9.0.0.
388+
* Deprecated Scheduled for removal in Drupal 10.0.0.
384389
* Use $this->assertSession()->linkByHrefExists() instead.
385390
*/
386391
protected function assertLinkByHref($href, $index = 0) {
@@ -393,7 +398,7 @@ protected function assertLinkByHref($href, $index = 0) {
393398
* @param string $href
394399
* The full or partial value of the 'href' attribute of the anchor tag.
395400
*
396-
* @deprecated Scheduled for removal in Drupal 9.0.0.
401+
* Deprecated Scheduled for removal in Drupal 10.0.0.
397402
* Use $this->assertSession()->linkByHrefNotExists() instead.
398403
*/
399404
protected function assertNoLinkByHref($href) {
@@ -413,7 +418,7 @@ protected function assertNoLinkByHref($href) {
413418
*
414419
* @throws \Behat\Mink\Exception\ExpectationException
415420
*
416-
* @deprecated Scheduled for removal in Drupal 9.0.0.
421+
* Deprecated Scheduled for removal in Drupal 10.0.0.
417422
* Use $this->assertSession()->fieldNotExists() or
418423
* $this->assertSession()->buttonNotExists() or
419424
* $this->assertSession()->fieldValueNotEquals() instead.
@@ -428,7 +433,7 @@ protected function assertNoFieldById($id, $value = '') {
428433
* @param \Drupal\Core\Url|string $path
429434
* The expected system path or URL.
430435
*
431-
* @deprecated Scheduled for removal in Drupal 9.0.0.
436+
* Deprecated Scheduled for removal in Drupal 10.0.0.
432437
* Use $this->assertSession()->addressEquals() instead.
433438
*/
434439
protected function assertUrl($path) {
@@ -443,7 +448,7 @@ protected function assertUrl($path) {
443448
* @param string $option
444449
* Option to assert.
445450
*
446-
* @deprecated Scheduled for removal in Drupal 9.0.0.
451+
* Deprecated Scheduled for removal in Drupal 10.0.0.
447452
* Use $this->assertSession()->optionExists() instead.
448453
*/
449454
protected function assertOption($id, $option) {
@@ -458,7 +463,7 @@ protected function assertOption($id, $option) {
458463
* @param string $text
459464
* The text for the option tag to assert.
460465
*
461-
* @deprecated Scheduled for removal in Drupal 9.0.0.
466+
* Deprecated Scheduled for removal in Drupal 10.0.0.
462467
* Use $this->assertSession()->optionExists() instead.
463468
*/
464469
protected function assertOptionByText($id, $text) {
@@ -473,7 +478,7 @@ protected function assertOptionByText($id, $text) {
473478
* @param string $option
474479
* Option to assert.
475480
*
476-
* @deprecated Scheduled for removal in Drupal 9.0.0.
481+
* Deprecated Scheduled for removal in Drupal 10.0.0.
477482
* Use $this->assertSession()->optionNotExists() instead.
478483
*/
479484
protected function assertNoOption($id, $option) {
@@ -491,7 +496,7 @@ protected function assertNoOption($id, $option) {
491496
* (optional) A message to display with the assertion. Do not translate
492497
* messages with t(). If left blank, a default message will be displayed.
493498
*
494-
* @deprecated Scheduled for removal in Drupal 9.0.0.
499+
* Deprecated Scheduled for removal in Drupal 10.0.0.
495500
* Use $this->assertSession()->optionExists() instead and check the
496501
* "selected" attribute yourself.
497502
*/
@@ -507,7 +512,7 @@ protected function assertOptionSelected($id, $option, $message = NULL) {
507512
* @param string $id
508513
* ID of field to assert.
509514
*
510-
* @deprecated Scheduled for removal in Drupal 9.0.0.
515+
* Deprecated Scheduled for removal in Drupal 10.0.0.
511516
* Use $this->assertSession()->checkboxChecked() instead.
512517
*/
513518
protected function assertFieldChecked($id) {
@@ -520,7 +525,7 @@ protected function assertFieldChecked($id) {
520525
* @param string $id
521526
* ID of field to assert.
522527
*
523-
* @deprecated Scheduled for removal in Drupal 9.0.0.
528+
* Deprecated Scheduled for removal in Drupal 10.0.0.
524529
* Use $this->assertSession()->checkboxNotChecked() instead.
525530
*/
526531
protected function assertNoFieldChecked($id) {
@@ -540,7 +545,7 @@ protected function assertNoFieldChecked($id) {
540545
* (optional) A message to display with the assertion. Do not translate
541546
* messages with t().
542547
*
543-
* @deprecated Scheduled for removal in Drupal 9.0.0.
548+
* Deprecated Scheduled for removal in Drupal 10.0.0.
544549
* Use $this->xpath() instead and check the values directly in the test.
545550
*/
546551
protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
@@ -563,7 +568,7 @@ protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
563568
*
564569
* @throws \Behat\Mink\Exception\ExpectationException
565570
*
566-
* @deprecated Scheduled for removal in Drupal 9.0.0.
571+
* Deprecated Scheduled for removal in Drupal 10.0.0.
567572
* Use $this->xpath() instead and assert that the result is empty.
568573
*/
569574
protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '') {
@@ -601,7 +606,7 @@ protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '') {
601606
* (optional) A message to display with the assertion. Do not translate
602607
* messages with t().
603608
*
604-
* @deprecated Scheduled for removal in Drupal 9.0.0.
609+
* Deprecated Scheduled for removal in Drupal 10.0.0.
605610
* Iterate over the fields yourself instead and directly check the values in
606611
* the test.
607612
*/
@@ -650,7 +655,7 @@ protected function assertFieldsByValue($fields, $value = NULL, $message = '') {
650655
* @param string $raw
651656
* Raw (HTML) string to look for.
652657
*
653-
* @deprecated Scheduled for removal in Drupal 9.0.0.
658+
* Deprecated Scheduled for removal in Drupal 10.0.0.
654659
* Use $this->assertSession()->assertEscaped() instead.
655660
*/
656661
protected function assertEscaped($raw) {
@@ -665,7 +670,7 @@ protected function assertEscaped($raw) {
665670
* @param string $raw
666671
* Raw (HTML) string to look for.
667672
*
668-
* @deprecated Scheduled for removal in Drupal 9.0.0.
673+
* Deprecated Scheduled for removal in Drupal 10.0.0.
669674
* Use $this->assertSession()->assertNoEscaped() instead.
670675
*/
671676
protected function assertNoEscaped($raw) {
@@ -678,7 +683,7 @@ protected function assertNoEscaped($raw) {
678683
* @param string $pattern
679684
* Perl regex to look for including the regex delimiters.
680685
*
681-
* @deprecated Scheduled for removal in Drupal 9.0.0.
686+
* Deprecated Scheduled for removal in Drupal 10.0.0.
682687
* Use $this->assertSession()->responseMatches() instead.
683688
*/
684689
protected function assertPattern($pattern) {
@@ -691,7 +696,7 @@ protected function assertPattern($pattern) {
691696
* @param string $pattern
692697
* Perl regex to look for including the regex delimiters.
693698
*
694-
* @deprecated Scheduled for removal in Drupal 9.0.0.
699+
* Deprecated Scheduled for removal in Drupal 10.0.0.
695700
* Use $this->assertSession()->responseNotMatches() instead.
696701
*
697702
* @see https://www.drupal.org/node/2864262
@@ -707,7 +712,7 @@ protected function assertNoPattern($pattern) {
707712
* @param string $expected_cache_tag
708713
* The expected cache tag.
709714
*
710-
* @deprecated Scheduled for removal in Drupal 9.0.0.
715+
* Deprecated Scheduled for removal in Drupal 10.0.0.
711716
* Use $this->assertSession()->responseHeaderContains() instead.
712717
*/
713718
protected function assertCacheTag($expected_cache_tag) {
@@ -720,7 +725,7 @@ protected function assertCacheTag($expected_cache_tag) {
720725
* @param string $cache_tag
721726
* The cache tag to check.
722727
*
723-
* @deprecated Scheduled for removal in Drupal 9.0.0.
728+
* Deprecated Scheduled for removal in Drupal 10.0.0.
724729
* Use $this->assertSession()->responseHeaderNotContains() instead.
725730
*
726731
* @see https://www.drupal.org/node/2864029
@@ -738,7 +743,7 @@ protected function assertNoCacheTag($cache_tag) {
738743
* @param string $value
739744
* Value of the header to assert
740745
*
741-
* @deprecated Scheduled for removal in Drupal 9.0.0.
746+
* Deprecated Scheduled for removal in Drupal 10.0.0.
742747
* Use $this->assertSession()->responseHeaderEquals() instead.
743748
*/
744749
protected function assertHeader($name, $value) {
@@ -776,7 +781,7 @@ abstract public function assertSession($name = NULL);
776781
* @return string
777782
* An XPath query with arguments replaced.
778783
*
779-
* @deprecated Scheduled for removal in Drupal 9.0.0.
784+
* Deprecated Scheduled for removal in Drupal 10.0.0.
780785
* Use $this->assertSession()->buildXPathQuery() instead.
781786
*/
782787
protected function buildXPathQuery($xpath, array $args = []) {
@@ -794,7 +799,7 @@ protected function buildXPathQuery($xpath, array $args = []) {
794799
* @return string
795800
* XPath for specified values.
796801
*
797-
* @deprecated Scheduled for removal in Drupal 9.0.0.
802+
* Deprecated Scheduled for removal in Drupal 10.0.0.
798803
* Use $this->getSession()->getPage()->findField() instead.
799804
*/
800805
protected function constructFieldXpath($attribute, $value) {
@@ -805,7 +810,7 @@ protected function constructFieldXpath($attribute, $value) {
805810
/**
806811
* Gets the current raw content.
807812
*
808-
* @deprecated Scheduled for removal in Drupal 9.0.0.
813+
* Deprecated Scheduled for removal in Drupal 10.0.0.
809814
* Use $this->getSession()->getPage()->getContent() instead.
810815
*/
811816
protected function getRawContent() {
@@ -822,7 +827,7 @@ protected function getRawContent() {
822827
* @return \Behat\Mink\Element\NodeElement[]
823828
* Option elements in select.
824829
*
825-
* @deprecated Scheduled for removal in Drupal 9.0.0.
830+
* Deprecated Scheduled for removal in Drupal 10.0.0.
826831
* Use $element->findAll('xpath', 'option') instead.
827832
*/
828833
protected function getAllOptions(NodeElement $element) {

0 commit comments

Comments
 (0)