- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/custom-css-setting.php
r48858 r48937 80 80 function test_construct() { 81 81 $this->assertTrue( post_type_exists( 'custom_css' ) ); 82 $this->assert Equals( 'custom_css', $this->setting->type );83 $this->assert Equals( get_stylesheet(), $this->setting->stylesheet );84 $this->assert Equals( 'edit_css', $this->setting->capability );82 $this->assertSame( 'custom_css', $this->setting->type ); 83 $this->assertSame( get_stylesheet(), $this->setting->stylesheet ); 84 $this->assertSame( 'edit_css', $this->setting->capability ); 85 85 86 86 $exception = null; … … 114 114 115 115 $this->setting->default = '/* Hello World */'; 116 $this->assert Equals( $this->setting->default, $this->setting->value() );116 $this->assertSame( $this->setting->default, $this->setting->value() ); 117 117 118 118 $this->assertNull( wp_get_custom_css_post() ); … … 144 144 remove_theme_mod( 'custom_css_post_id' ); 145 145 146 $this->assert Equals( $post_id, wp_get_custom_css_post()->ID );147 $this->assert Equals( $post_id, wp_get_custom_css_post( $this->setting->stylesheet )->ID );148 $this->assert Equals( $twentyten_post_id, wp_get_custom_css_post( 'twentyten' )->ID );149 150 $this->assert Equals( $original_css, wp_get_custom_css( $this->setting->stylesheet ) );151 $this->assert Equals( $original_css, $this->setting->value() );152 $this->assert Equals( $twentyten_css, wp_get_custom_css( 'twentyten' ) );153 $this->assert Equals( $twentyten_css, $twentyten_setting->value() );146 $this->assertSame( $post_id, wp_get_custom_css_post()->ID ); 147 $this->assertSame( $post_id, wp_get_custom_css_post( $this->setting->stylesheet )->ID ); 148 $this->assertSame( $twentyten_post_id, wp_get_custom_css_post( 'twentyten' )->ID ); 149 150 $this->assertSame( $original_css, wp_get_custom_css( $this->setting->stylesheet ) ); 151 $this->assertSame( $original_css, $this->setting->value() ); 152 $this->assertSame( $twentyten_css, wp_get_custom_css( 'twentyten' ) ); 153 $this->assertSame( $twentyten_css, $twentyten_setting->value() ); 154 154 155 155 $updated_css = 'body { color: blue; }'; … … 158 158 159 159 $this->assertNotFalse( $saved ); 160 $this->assert Equals( $updated_css, $this->setting->value() );161 $this->assert Equals( $updated_css, wp_get_custom_css( $this->setting->stylesheet ) );162 $this->assert Equals( $updated_css, get_post( $post_id )->post_content );160 $this->assertSame( $updated_css, $this->setting->value() ); 161 $this->assertSame( $updated_css, wp_get_custom_css( $this->setting->stylesheet ) ); 162 $this->assertSame( $updated_css, get_post( $post_id )->post_content ); 163 163 164 164 $previewed_css = 'body { color: red; }'; 165 165 $this->wp_customize->set_post_value( $this->setting->id, $previewed_css ); 166 166 $this->setting->preview(); 167 $this->assert Equals( $previewed_css, $this->setting->value() );168 $this->assert Equals( $previewed_css, wp_get_custom_css( $this->setting->stylesheet ) );167 $this->assertSame( $previewed_css, $this->setting->value() ); 168 $this->assertSame( $previewed_css, wp_get_custom_css( $this->setting->stylesheet ) ); 169 169 170 170 // Make sure that wp_update_custom_css_post() works as expected for updates. … … 177 177 ); 178 178 $this->assertInstanceOf( 'WP_Post', $r ); 179 $this->assert Equals( $post_id, $r->ID );180 $this->assert Equals( 'body { color:red; }', get_post( $r )->post_content );181 $this->assert Equals( "body\n\tcolor:red;", get_post( $r )->post_content_filtered );179 $this->assertSame( $post_id, $r->ID ); 180 $this->assertSame( 'body { color:red; }', get_post( $r )->post_content ); 181 $this->assertSame( "body\n\tcolor:red;", get_post( $r )->post_content_filtered ); 182 182 $r = wp_update_custom_css_post( 'body { content: "\o/"; }' ); 183 $this->assert Equals( $this->wp_customize->get_stylesheet(), get_post( $r )->post_name );184 $this->assert Equals( 'body { content: "\o/"; }', get_post( $r )->post_content );185 $this->assert Equals( '', get_post( $r )->post_content_filtered );183 $this->assertSame( $this->wp_customize->get_stylesheet(), get_post( $r )->post_name ); 184 $this->assertSame( 'body { content: "\o/"; }', get_post( $r )->post_content ); 185 $this->assertSame( '', get_post( $r )->post_content_filtered ); 186 186 187 187 // Make sure that wp_update_custom_css_post() works as expected for insertion. … … 193 193 ); 194 194 $this->assertInstanceOf( 'WP_Post', $r ); 195 $this->assert Equals( 'other', get_post( $r )->post_name );196 $this->assert Equals( 'body { background:black; }', get_post( $r )->post_content );197 $this->assert Equals( 'publish', get_post( $r )->post_status );195 $this->assertSame( 'other', get_post( $r )->post_name ); 196 $this->assertSame( 'body { background:black; }', get_post( $r )->post_content ); 197 $this->assertSame( 'publish', get_post( $r )->post_status ); 198 198 199 199 // Test deletion. … … 201 201 $this->assertNull( wp_get_custom_css_post() ); 202 202 $this->assertNull( wp_get_custom_css_post( get_stylesheet() ) ); 203 $this->assert Equals( $previewed_css, wp_get_custom_css( get_stylesheet() ), 'Previewed value remains in spite of deleted post.' );203 $this->assertSame( $previewed_css, wp_get_custom_css( get_stylesheet() ), 'Previewed value remains in spite of deleted post.' ); 204 204 wp_delete_post( $twentyten_post_id ); 205 205 $this->assertNull( wp_get_custom_css_post( 'twentyten' ) ); 206 $this->assert Equals( '', wp_get_custom_css( 'twentyten' ) );206 $this->assertSame( '', wp_get_custom_css( 'twentyten' ) ); 207 207 } 208 208 … … 272 272 add_filter( 'customize_value_custom_css', array( $this, 'filter_value' ), 10, 2 ); 273 273 $this->setting->default = '/*default*/'; 274 $this->assert Equals( '/*default*//*filtered*/', $this->setting->value() );274 $this->assertSame( '/*default*//*filtered*/', $this->setting->value() ); 275 275 276 276 $this->factory()->post->create( … … 284 284 ); 285 285 remove_theme_mod( 'custom_css_post_id' ); 286 $this->assert Equals( '/*custom*//*filtered*/', $this->setting->value() );286 $this->assertSame( '/*custom*//*filtered*/', $this->setting->value() ); 287 287 288 288 $this->wp_customize->set_post_value( $this->setting->id, '/*overridden*/' ); 289 289 $this->setting->preview(); 290 $this->assert Equals( '/*overridden*/', $this->setting->value(), 'Expected value to not be filtered since post value is present.' );290 $this->assertSame( '/*overridden*/', $this->setting->value(), 'Expected value to not be filtered since post value is present.' ); 291 291 } 292 292 … … 331 331 332 332 $post = get_post( $post_id ); 333 $this->assert Equals( $original_title, $post->post_title );333 $this->assertSame( $original_title, $post->post_title ); 334 334 $this->assertContains( $overridden_css, $post->post_content ); 335 335 $this->assertContains( '/* filtered post_content */', $post->post_content ); … … 347 347 $this->assertInternalType( 'array', $data ); 348 348 $this->assertEqualSets( array( 'css', 'preprocessed' ), array_keys( $data ) ); 349 $this->assert Equals( '', $data['preprocessed'] );349 $this->assertSame( '', $data['preprocessed'] ); 350 350 $this->assertInternalType( 'array', $args ); 351 351 $this->assertEqualSets( array( 'css', 'preprocessed', 'stylesheet' ), array_keys( $args ) ); 352 $this->assert Equals( $args['css'], $data['css'] );353 $this->assert Equals( $args['preprocessed'], $data['preprocessed'] );352 $this->assertSame( $args['css'], $data['css'] ); 353 $this->assertSame( $args['preprocessed'], $data['preprocessed'] ); 354 354 355 355 $data['css'] .= '/* filtered post_content */';
Note: See TracChangeset
for help on using the changeset viewer.