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

Follow-up to [35249], [49003].

See #51344.

git-svn-id: https://develop.svn.wordpress.org/trunk@49005 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-09-19 11:11:00 +00:00
parent 4018e92c39
commit 898eb5fc51
4 changed files with 21 additions and 13 deletions
+4 -2
View File
@@ -7,9 +7,11 @@
*/
class Tests_User_Slashes extends WP_UnitTestCase {
protected static $author_id;
protected static $user_id;
public static function wpSetUpBeforeClass( $factory ) {
self::$author_id = $factory->user->create( array( 'role' => 'administrator' ) );
self::$user_id = $factory->user->create();
}
function setUp() {
@@ -87,7 +89,7 @@ class Tests_User_Slashes extends WP_UnitTestCase {
* Tests the controller function that expects slashed data.
*/
function test_edit_user() {
$user_id = self::factory()->user->create();
$user_id = self::$user_id;
$_POST = array();
$_GET = array();
@@ -185,7 +187,7 @@ class Tests_User_Slashes extends WP_UnitTestCase {
* Tests the model function that expects slashed data.
*/
function test_wp_update_user() {
$user_id = self::factory()->user->create();
$user_id = self::$user_id;
$user_id = wp_update_user(
array(
'ID' => $user_id,