Tests: Speed up slashed data tests by reusing shared fixtures.

Follow-up to [35249].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49003 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-09-19 10:34:54 +00:00
parent 0c5324df3b
commit ffc129395c
6 changed files with 40 additions and 11 deletions
+9 -3
View File
@@ -6,11 +6,17 @@
* @ticket 21767
*/
class Tests_Comment_Slashes extends WP_UnitTestCase {
protected static $author_id;
public static function wpSetUpBeforeClass( $factory ) {
// We need an admin user to bypass comment flood protection.
self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
}
function setUp() {
parent::setUp();
// We need an admin user to bypass comment flood protection.
$this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
wp_set_current_user( $this->author_id );
wp_set_current_user( self::$author_id );
// It is important to test with both even and odd numbered slashes,
// as KSES does a strip-then-add slashes in some of its function calls.