| 3028 | |
| 3029 | /** |
| 3030 | * @ticket 39120 |
| 3031 | */ |
| 3032 | function test_get_and_set() { |
| 3033 | |
| 3034 | $comments = new WP_Comment_Query; |
| 3035 | |
| 3036 | $this->assertNull( $comments->get( 'fields' ) ); |
| 3037 | $this->assertNull( $comments->query_vars['fields'] ); |
| 3038 | |
| 3039 | $comments->set( 'fields', 'ids' ); |
| 3040 | $this->assertSame( 'ids', $comments->get( 'fields' ) ); |
| 3041 | $this->assertSame( 'ids', $comments->query_vars['fields'] ); |
| 3042 | |
| 3043 | $comments->set( 'fields', '' ); |
| 3044 | $this->assertSame( '', $comments->get( 'fields' ) ); |
| 3045 | $this->assertSame( '', $comments->query_vars['fields'] ); |
| 3046 | |
| 3047 | $this->assertNull( $comments->get( 'does-not-exist' ) ); |
| 3048 | $this->assertSame( 'foo', $comments->get( 'does-not-exist', 'foo' ) ); |
| 3049 | } |
| 3050 | |