mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23: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:
@@ -17,7 +17,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
* @ticket 34245
|
||||
*/
|
||||
public function test_get_term_field_should_not_return_error_for_empty_taxonomy() {
|
||||
$term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
|
||||
$found = get_term_field( 'taxonomy', $term->term_id, '' );
|
||||
$this->assertNotWPError( $found );
|
||||
@@ -28,7 +28,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
* @ticket 34245
|
||||
*/
|
||||
public function test_get_term_field_supplying_a_taxonomy() {
|
||||
$term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
|
||||
$found = get_term_field( 'taxonomy', $term->term_id, $term->taxonomy );
|
||||
$this->assertSame( $this->taxonomy, $found );
|
||||
@@ -38,7 +38,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
* @ticket 34245
|
||||
*/
|
||||
public function test_get_term_field_supplying_no_taxonomy() {
|
||||
$term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
|
||||
$found = get_term_field( 'taxonomy', $term->term_id );
|
||||
$this->assertSame( $this->taxonomy, $found );
|
||||
@@ -48,7 +48,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
* @ticket 34245
|
||||
*/
|
||||
public function test_get_term_field_should_accept_a_WP_Term_object_or_a_term_id() {
|
||||
$term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
|
||||
$this->assertInstanceOf( 'WP_Term', $term );
|
||||
$this->assertSame( $term->term_id, get_term_field( 'term_id', $term ) );
|
||||
@@ -59,7 +59,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
* @ticket 34245
|
||||
*/
|
||||
public function test_get_term_field_invalid_taxonomy_should_return_WP_Error() {
|
||||
$term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
$term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
|
||||
|
||||
$found = get_term_field( 'taxonomy', $term, 'foo-taxonomy' );
|
||||
$this->assertWPError( $found );
|
||||
|
||||
Reference in New Issue
Block a user