Changeset 35225 for trunk/tests/phpunit/tests/term/meta.php
- Timestamp:
- 10/16/2015 09:04:12 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/term/meta.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/meta.php
r35112 r35225 13 13 14 14 public function test_add() { 15 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );15 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 16 16 17 17 $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) ); … … 19 19 20 20 public function test_add_unique() { 21 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );21 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 22 22 23 23 $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) ); … … 26 26 27 27 public function test_delete() { 28 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );28 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 29 29 add_term_meta( $t, 'foo', 'bar' ); 30 30 … … 33 33 34 34 public function test_delete_with_invalid_meta_key_should_return_false() { 35 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );35 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 36 36 37 37 $this->assertFalse( delete_term_meta( $t, 'foo' ) ); … … 39 39 40 40 public function test_delete_should_respect_meta_value() { 41 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );41 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 42 42 add_term_meta( $t, 'foo', 'bar' ); 43 43 add_term_meta( $t, 'foo', 'baz' ); … … 50 50 51 51 public function test_get_with_no_key_should_fetch_all_keys() { 52 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );52 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 53 53 add_term_meta( $t, 'foo', 'bar' ); 54 54 add_term_meta( $t, 'foo1', 'baz' ); … … 64 64 65 65 public function test_get_with_key_should_fetch_all_for_key() { 66 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );66 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 67 67 add_term_meta( $t, 'foo', 'bar' ); 68 68 add_term_meta( $t, 'foo', 'baz' ); … … 76 76 77 77 public function test_get_should_respect_single_true() { 78 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );78 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 79 79 add_term_meta( $t, 'foo', 'bar' ); 80 80 add_term_meta( $t, 'foo', 'baz' ); … … 85 85 86 86 public function test_update_should_pass_to_add_when_no_value_exists_for_key() { 87 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );87 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 88 88 89 89 $actual = update_term_meta( $t, 'foo', 'bar' ); … … 96 96 97 97 public function test_update_should_return_true_when_updating_existing_value_for_key() { 98 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );98 $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 99 99 100 100 add_term_meta( $t, 'foo', 'bar' ); … … 110 110 global $wpdb; 111 111 112 $p = $this->factory->post->create( array( 'post_status' => 'publish' ) );112 $p = self::$factory->post->create( array( 'post_status' => 'publish' ) ); 113 113 114 114 register_taxonomy( 'wptests_tax', 'post' ); 115 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );115 $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 116 116 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 117 117 foreach ( $terms as $t ) { … … 120 120 121 121 // Create another term, which should *not* be lazy loaded because it's unattached. 122 $orphan_term = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );122 $orphan_term = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 123 123 add_term_meta( $orphan_term, 'foo', 'bar' ); 124 124 … … 155 155 global $wpdb; 156 156 157 $posts = $this->factory->post->create_many( 3, array( 'post_status' => 'publish' ) );157 $posts = self::$factory->post->create_many( 3, array( 'post_status' => 'publish' ) ); 158 158 register_taxonomy( 'wptests_tax', 'post' ); 159 $terms = $this->factory->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) );159 $terms = self::$factory->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) ); 160 160 161 161 wp_set_object_terms( $posts[0], array( $terms[0], $terms[1] ), 'wptests_tax' ); … … 202 202 203 203 public function test_adding_term_meta_should_bust_get_terms_cache() { 204 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );204 $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 205 205 206 206 add_term_meta( $terms[0], 'foo', 'bar' ); … … 237 237 238 238 public function test_updating_term_meta_should_bust_get_terms_cache() { 239 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );239 $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 240 240 241 241 add_term_meta( $terms[0], 'foo', 'bar' ); … … 273 273 274 274 public function test_deleting_term_meta_should_bust_get_terms_cache() { 275 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );275 $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 276 276 277 277 add_term_meta( $terms[0], 'foo', 'bar' );
Note: See TracChangeset
for help on using the changeset viewer.