Changeset 64747
- Timestamp:
- 10/26/2026 09:49:27 PM (4 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/wpAjaxParseMediaShortcode.php
r64505 r64747 34 34 ) 35 35 ); 36 $factory->attachment->create_object( 37 get_temp_dir() . 'canola.jpg', 38 0, 39 array( 40 'post_mime_type' => 'image/jpeg', 41 'post_excerpt' => 'An unrelated caption', 42 ) 43 ); 36 44 } 37 45 /** … … 40 48 public function test_parse_shortcode( array $payload, $expected ) { 41 49 add_shortcode( 'test', array( $this, 'shortcode_test' ) ); 50 $payload['shortcode'] = sprintf( $payload['shortcode'], self::$media_id ); 42 51 43 52 $_POST = array_merge( … … 61 70 } 62 71 $this->assertSame( $expected['success'], $response['success'] ); 72 if ( $expected['success'] ) { 73 $this->assertStringContainsString( 'A sample caption', $body ); 74 $this->assertStringNotContainsString( 'An unrelated caption', $body ); 75 } 63 76 } 64 77 … … 70 83 return array( 71 84 'gallery_shortcode_is_allowed' => array( 72 'payload' => array( 'shortcode' => '[gallery ids=" ' . self::$media_id . '"]' ),85 'payload' => array( 'shortcode' => '[gallery ids="%d"]' ), 73 86 'expected' => array( 'success' => true ), 74 87 ), 75 88 'gallery_and_custom_test_shortcode_is_not_allowed' => array( 76 'payload' => array( 'shortcode' => '[gallery ids=" ' . self::$media_id . '"] [test]' ),89 'payload' => array( 'shortcode' => '[gallery ids="%d"] [test]' ), 77 90 'expected' => array( 'success' => false ), 78 91 ),
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)