Changeset 34089 for trunk/tests/phpunit/tests/query/setupPostdata.php
- Timestamp:
- 09/12/2015 08:57:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/setupPostdata.php
r30976 r34089 45 45 $this->assertNotEmpty( $p->ID ); 46 46 $this->assertSame( $p->ID, $GLOBALS['id'] ); 47 } 48 49 /** 50 * @ticket 30970 51 */ 52 public function test_setup_by_id() { 53 $p = $this->factory->post->create_and_get(); 54 setup_postdata( $p->ID ); 55 56 $this->assertSame( $p->ID, $GLOBALS['id'] ); 57 } 58 59 /** 60 * @ticket 30970 61 */ 62 public function test_setup_by_fake_post() { 63 $fake = new stdClass; 64 $fake->ID = 98765; 65 setup_postdata( $fake->ID ); 66 67 // Fails because there's no post with this ID. 68 $this->assertNotSame( $fake->ID, $GLOBALS['id'] ); 69 } 70 71 /** 72 * @ticket 30970 73 */ 74 public function test_setup_by_postish_object() { 75 $p = $this->factory->post->create(); 76 77 $post = new stdClass(); 78 $post->ID = $p; 79 setup_postdata( $p ); 80 81 $this->assertSame( $p, $GLOBALS['id'] ); 47 82 } 48 83
Note: See TracChangeset
for help on using the changeset viewer.