mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Unit Tests: after [35225], make factory a method/getter on WP_UnitTestCase and add magic methods for BC for every plugin that is extending WP_UnitTestCase and accessing the $factory instance prop.
Props nerrad, wonderboymusic. See #30017, #33968. git-svn-id: https://develop.svn.wordpress.org/trunk@35242 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -15,7 +15,7 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->author_id = self::$factory->user->create( array(
|
||||
$this->author_id = self::factory()->user->create( array(
|
||||
'role' => 'author',
|
||||
'user_login' => 'test_author',
|
||||
'description' => 'test_author',
|
||||
@@ -31,7 +31,7 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
// insert a post and make sure the ID is ok
|
||||
$this->post_id = self::$factory->post->create( $post );
|
||||
$this->post_id = self::factory()->post->create( $post );
|
||||
|
||||
setup_postdata( get_post( $this->post_id ) );
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
function test_get_the_author_posts_with_custom_post_type() {
|
||||
register_post_type( 'wptests_pt' );
|
||||
|
||||
$cpt_ids = self::$factory->post->create_many( 2, array(
|
||||
$cpt_ids = self::factory()->post->create_many( 2, array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_type' => 'wptests_pt',
|
||||
) );
|
||||
@@ -105,7 +105,7 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
* @ticket 30355
|
||||
*/
|
||||
public function test_get_the_author_posts_link_no_permalinks() {
|
||||
$author = self::$factory->user->create_and_get( array(
|
||||
$author = self::factory()->user->create_and_get( array(
|
||||
'display_name' => 'Foo',
|
||||
'user_nicename' => 'bar'
|
||||
) );
|
||||
@@ -129,7 +129,7 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
public function test_get_the_author_posts_link_with_permalinks() {
|
||||
$this->set_permalink_structure( '/%postname%/' );
|
||||
|
||||
$author = self::$factory->user->create_and_get( array(
|
||||
$author = self::factory()->user->create_and_get( array(
|
||||
'display_name' => 'Foo',
|
||||
'user_nicename' => 'bar'
|
||||
) );
|
||||
|
||||
Reference in New Issue
Block a user