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:
parent
0c5324df3b
commit
ffc129395c
@ -6,10 +6,16 @@
|
||||
* @ticket 21767
|
||||
*/
|
||||
class Tests_Attachment_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->author_id = self::factory()->user->create( array( 'role' => 'editor' ) );
|
||||
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.
|
||||
|
@ -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.
|
||||
|
@ -6,8 +6,10 @@
|
||||
* @ticket 21767
|
||||
*/
|
||||
class Tests_Option_Slashes extends WP_UnitTestCase {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// 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.
|
||||
$this->slash_1 = 'String with 1 slash \\';
|
||||
|
@ -6,11 +6,16 @@
|
||||
* @ticket 21767
|
||||
*/
|
||||
class Tests_Post_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'editor' ) );
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->author_id = self::factory()->user->create( array( 'role' => 'editor' ) );
|
||||
|
||||
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.
|
||||
|
@ -6,11 +6,16 @@
|
||||
* @ticket 21767
|
||||
*/
|
||||
class Tests_Term_Slashes extends WP_Ajax_UnitTestCase {
|
||||
protected static $author_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
|
||||
|
||||
wp_set_current_user( $this->author_id );
|
||||
wp_set_current_user( self::$author_id );
|
||||
|
||||
$this->slash_1 = 'String with 1 slash \\';
|
||||
$this->slash_2 = 'String with 2 slashes \\\\';
|
||||
|
@ -6,11 +6,16 @@
|
||||
* @ticket 21767
|
||||
*/
|
||||
class Tests_User_Slashes extends WP_UnitTestCase {
|
||||
protected static $author_id;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$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.
|
||||
|
Loading…
Reference in New Issue
Block a user