Changeset 42343 for trunk/tests/phpunit/tests/term/slashes.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/slashes.php
r35244 r42343 24 24 /** 25 25 * Tests the model function that expects slashed data 26 *27 26 */ 28 27 function test_wp_insert_term() { 29 28 $taxonomies = array( 30 29 'category', 31 'post_tag' 30 'post_tag', 32 31 ); 33 32 foreach ( $taxonomies as $taxonomy ) { … … 36 35 $taxonomy, 37 36 array( 38 'slug' => 'slash_test_1_'.$taxonomy,39 'description' => $this->slash_3 37 'slug' => 'slash_test_1_' . $taxonomy, 38 'description' => $this->slash_3, 40 39 ) 41 40 ); 42 $term = get_term( $insert['term_id'], $taxonomy );41 $term = get_term( $insert['term_id'], $taxonomy ); 43 42 $this->assertEquals( wp_unslash( $this->slash_1 ), $term->name ); 44 43 $this->assertEquals( wp_unslash( $this->slash_3 ), $term->description ); … … 48 47 $taxonomy, 49 48 array( 50 'slug' => 'slash_test_2_'.$taxonomy,51 'description' => $this->slash_5 49 'slug' => 'slash_test_2_' . $taxonomy, 50 'description' => $this->slash_5, 52 51 ) 53 52 ); 54 $term = get_term( $insert['term_id'], $taxonomy );53 $term = get_term( $insert['term_id'], $taxonomy ); 55 54 $this->assertEquals( wp_unslash( $this->slash_3 ), $term->name ); 56 55 $this->assertEquals( wp_unslash( $this->slash_5 ), $term->description ); … … 60 59 $taxonomy, 61 60 array( 62 'slug' => 'slash_test_3_'.$taxonomy,63 'description' => $this->slash_4 61 'slug' => 'slash_test_3_' . $taxonomy, 62 'description' => $this->slash_4, 64 63 ) 65 64 ); 66 $term = get_term( $insert['term_id'], $taxonomy );65 $term = get_term( $insert['term_id'], $taxonomy ); 67 66 $this->assertEquals( wp_unslash( $this->slash_2 ), $term->name ); 68 67 $this->assertEquals( wp_unslash( $this->slash_4 ), $term->description ); … … 72 71 /** 73 72 * Tests the model function that expects slashed data 74 *75 73 */ 76 74 function test_wp_update_term() { 77 75 $taxonomies = array( 78 76 'category', 79 'post_tag' 77 'post_tag', 80 78 ); 81 79 foreach ( $taxonomies as $taxonomy ) { 82 $id = self::factory()->term->create(array( 83 'taxonomy' => $taxonomy 84 )); 80 $id = self::factory()->term->create( 81 array( 82 'taxonomy' => $taxonomy, 83 ) 84 ); 85 85 86 86 $update = wp_update_term( … … 88 88 $taxonomy, 89 89 array( 90 'name' => $this->slash_1,91 'description' => $this->slash_3 90 'name' => $this->slash_1, 91 'description' => $this->slash_3, 92 92 ) 93 93 ); … … 101 101 $taxonomy, 102 102 array( 103 'name' => $this->slash_3,104 'description' => $this->slash_5 103 'name' => $this->slash_3, 104 'description' => $this->slash_5, 105 105 ) 106 106 ); 107 $term = get_term( $id, $taxonomy );107 $term = get_term( $id, $taxonomy ); 108 108 $this->assertEquals( wp_unslash( $this->slash_3 ), $term->name ); 109 109 $this->assertEquals( wp_unslash( $this->slash_5 ), $term->description ); … … 113 113 $taxonomy, 114 114 array( 115 'name' => $this->slash_2,116 'description' => $this->slash_4 115 'name' => $this->slash_2, 116 'description' => $this->slash_4, 117 117 ) 118 118 ); 119 $term = get_term( $id, $taxonomy );119 $term = get_term( $id, $taxonomy ); 120 120 $this->assertEquals( wp_unslash( $this->slash_2 ), $term->name ); 121 121 $this->assertEquals( wp_unslash( $this->slash_4 ), $term->description );
Note: See TracChangeset
for help on using the changeset viewer.