mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +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:
@@ -9,7 +9,7 @@ class Tests_Post_GetPostClass extends WP_UnitTestCase {
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->post_id = self::$factory->post->create();
|
||||
$this->post_id = self::factory()->post->create();
|
||||
}
|
||||
|
||||
public function test_with_tags() {
|
||||
@@ -22,7 +22,7 @@ class Tests_Post_GetPostClass extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_with_categories() {
|
||||
$cats = self::$factory->category->create_many( 2 );
|
||||
$cats = self::factory()->category->create_many( 2 );
|
||||
wp_set_post_terms( $this->post_id, $cats, 'category' );
|
||||
|
||||
$cat0 = get_term( $cats[0], 'category' );
|
||||
@@ -57,9 +57,9 @@ class Tests_Post_GetPostClass extends WP_UnitTestCase {
|
||||
* @ticket 30883
|
||||
*/
|
||||
public function test_with_utf8_category_slugs() {
|
||||
$cat_id1 = self::$factory->category->create( array( 'name' => 'Первая рубрика' ) );
|
||||
$cat_id2 = self::$factory->category->create( array( 'name' => 'Вторая рубрика' ) );
|
||||
$cat_id3 = self::$factory->category->create( array( 'name' => '25кадр' ) );
|
||||
$cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) );
|
||||
$cat_id2 = self::factory()->category->create( array( 'name' => 'Вторая рубрика' ) );
|
||||
$cat_id3 = self::factory()->category->create( array( 'name' => '25кадр' ) );
|
||||
wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' );
|
||||
|
||||
$found = get_post_class( '', $this->post_id );
|
||||
@@ -73,9 +73,9 @@ class Tests_Post_GetPostClass extends WP_UnitTestCase {
|
||||
* @ticket 30883
|
||||
*/
|
||||
public function test_with_utf8_tag_slugs() {
|
||||
$tag_id1 = self::$factory->tag->create( array( 'name' => 'Первая метка' ) );
|
||||
$tag_id2 = self::$factory->tag->create( array( 'name' => 'Вторая метка' ) );
|
||||
$tag_id3 = self::$factory->tag->create( array( 'name' => '25кадр' ) );
|
||||
$tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) );
|
||||
$tag_id2 = self::factory()->tag->create( array( 'name' => 'Вторая метка' ) );
|
||||
$tag_id3 = self::factory()->tag->create( array( 'name' => '25кадр' ) );
|
||||
wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' );
|
||||
|
||||
$found = get_post_class( '', $this->post_id );
|
||||
@@ -90,9 +90,9 @@ class Tests_Post_GetPostClass extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_with_utf8_term_slugs() {
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
$term_id1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
|
||||
$term_id2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
|
||||
$term_id3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
|
||||
$term_id1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
|
||||
$term_id2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
|
||||
$term_id3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
|
||||
wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' );
|
||||
|
||||
$found = get_post_class( '', $this->post_id );
|
||||
|
||||
Reference in New Issue
Block a user