Problem/Motivation

#2921860: \Drupal\simpletest\NodeCreationTrait @deprecated references new class in the incorrect namespace fixes an erroneous deprecation message introduced in #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits

Unfortunately other similar errors remain.

Many of those traits' deprecation messages are incorrect: http://cgit.drupalcode.org/drupal/commit/?h=8.4.x&id=71e5829354208d40c08...

UserCreationTrait, NodeCreationTrait, ContentTypeCreationTrait, BlockCreationTrait are all wrong, in 8.4.x and the unfixed ones in 8.5.x.

Proposed resolution

The traits' deprecation messages should all refer to the traits in their use block, instead of non-existent ones.

Remaining tasks

User interface changes

API changes

Data model changes

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

Mile23 created an issue. See original summary.

Mile23’s picture

Issue tags: +Novice
dawehner’s picture

@Mile23 Do you think its worth fixing this in 8.4.x?

Mile23’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Works for me

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Error, circular dependency:

namespace Drupal\simpletest;

use Drupal\Tests\AssertHelperTrait as BaseAssertHelperTrait;

/**                                                                             
 * Provides helper methods for assertions.                                      
 *                                                                              
 * @deprecated in Drupal 8.4.x. Will be removed before Drupal 9.0.0. Use        
 *   Drupal\Tests\AssertHelperTrait instead.                                    
 *                                                                              
 * @see https://www.drupal.org/node/2884454                                     
 */
trait AssertHelperTrait {

  use BaseAssertHelperTrait;

}


But:

/**                                                                             
  * Provides methods to create and place block with default settings.            
  *                                                                              
  * This trait is meant to be used only by test classes.                         
  *                                                                              
  * @deprecated in Drupal 8.4.x. Will be removed before Drupal 9.0.0. Use        
- *   Drupal\Tests\AssertHelperTrait instead.
+ *   \Drupal\Tests\block\Traits\BlockCreationTrait instead.                               
  *                                                                              
  * @see https://www.drupal.org/node/2884454                                     
  */
trait BlockCreationTrait {

  use BaseBlockCreationTrait;

}

Now both files are referring to themselves?

dawehner’s picture

Now both files are referring to themselves?

I'm a bit confused, doesn't \Drupal\simpletest\BlockCreationTrait refers to \Drupal\Tests\block\Traits\BlockCreationTrait
and \Drupal\simpletest\AssertHelperTrait to \Drupal\Tests\AssertHelperTrait ?

dawehner’s picture

Status: Needs work » Needs review
Mile23’s picture

All of these traits in the simpletest\ namespace are deprecated.

They either deprecate to traits that are in the Tests\ namespace, or in the module that is responsible for their behavior, such as node for ContentTypeCreationTrait.

Each deprecated trait uses the non-deprecated one, and the trait suggestion in the deprecation message should match the one being used.

  * @deprecated in Drupal 8.4.x. Will be removed before Drupal 9.0.0. Use        
- *   Drupal\Tests\AssertHelperTrait instead.
+ *   \Drupal\Tests\block\Traits\BlockCreationTrait instead.   

That one was just a victim of copypasta... It was not only the wrong namespace but the wrong trait name.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I think this is RTBC again.

xjm credited caseylau.

xjm’s picture

Title: Cleanup after BrowserTestBase re-arrange » Numerous deprecation messages for test traits do not reference the correct replacement

Okay, I see what happened now; thanks for explaining.

Adding credit for @caseylau who worked on #2922104: core/modules/simpletest/src/BlockCreationTrait.php has wrong comment "Drupal\Tests\AssertHelperTrait instead", which was a duplicate of the 8.5.x scope.

  • xjm committed 3786931 on 8.5.x
    Issue #2922371 by Mile23, dawehner, caseylau: Numerous deprecation...

  • xjm committed 1cd14ec on 8.4.x
    Issue #2922371 by Mile23, dawehner, caseylau: Numerous deprecation...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Committed the 8.5.x version to 8.5.x and the 8.4.x version to 8.4.x (not sure why such simple documentation fixes were not backported, but it's resolved now at least). Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.