| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @group post |
| 5 | * @ticket TODO |
| 6 | */ |
| 7 | class Tests_Post_GUID extends WP_UnitTestCase { |
| 8 | function setUp() { |
| 9 | parent::setUp(); |
| 10 | $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) ); |
| 11 | $this->old_current_user = get_current_user_id(); |
| 12 | wp_set_current_user( $this->author_id ); |
| 13 | |
| 14 | } |
| 15 | |
| 16 | function tearDown() { |
| 17 | wp_set_current_user( $this->old_current_user ); |
| 18 | parent::tearDown(); |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Tests that the GUID is not improperly escaped |
| 23 | * |
| 24 | */ |
| 25 | function test_wp_insert_post() { |
| 26 | $guid = 'http://www.wordpress.dev/?post_type=changeset&p=57'; |
| 27 | $id = wp_insert_post(array( |
| 28 | 'post_status' => 'publish', |
| 29 | 'post_title' => "Test", |
| 30 | 'post_content' => "Test", |
| 31 | 'post_excerpt' => "Test", |
| 32 | 'guid' => $guid, |
| 33 | 'post_type' => 'post', |
| 34 | 'slashed' => false, |
| 35 | )); |
| 36 | $post = get_post( $id ); |
| 37 | $this->assertEquals( $guid, $post->guid); |
| 38 | |
| 39 | } |
| 40 | |
| 41 | } |