|
@@ 1830-1850 (lines=21) @@
|
| 1827 |
|
$this->assertEquals(2, $found); |
| 1828 |
|
} |
| 1829 |
|
|
| 1830 |
|
public function test_post_type_single_value() |
| 1831 |
|
{ |
| 1832 |
|
register_post_type('post-type-1'); |
| 1833 |
|
register_post_type('post-type-2'); |
| 1834 |
|
|
| 1835 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'post-type-1' )); |
| 1836 |
|
$p2 = self::factory()->post->create(array( 'post_type' => 'post-type-2' )); |
| 1837 |
|
|
| 1838 |
|
$c1 = self::factory()->comment->create_post_comments($p1, 1); |
| 1839 |
|
$c2 = self::factory()->comment->create_post_comments($p2, 1); |
| 1840 |
|
|
| 1841 |
|
$q = new WP_Comment_Query(); |
| 1842 |
|
$found = $q->query( |
| 1843 |
|
array( |
| 1844 |
|
'fields' => 'ids', |
| 1845 |
|
'post_type' => 'post-type-2', |
| 1846 |
|
) |
| 1847 |
|
); |
| 1848 |
|
|
| 1849 |
|
$this->assertEqualSets($c2, $found); |
| 1850 |
|
|
| 1851 |
|
_unregister_post_type('post-type-1'); |
| 1852 |
|
_unregister_post_type('post-type-2'); |
| 1853 |
|
} |
|
@@ 1858-1878 (lines=21) @@
|
| 1855 |
|
/** |
| 1856 |
|
* @ticket 20006 |
| 1857 |
|
*/ |
| 1858 |
|
public function test_post_type_singleton_array() |
| 1859 |
|
{ |
| 1860 |
|
register_post_type('post-type-1'); |
| 1861 |
|
register_post_type('post-type-2'); |
| 1862 |
|
|
| 1863 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'post-type-1' )); |
| 1864 |
|
$p2 = self::factory()->post->create(array( 'post_type' => 'post-type-2' )); |
| 1865 |
|
|
| 1866 |
|
$c1 = self::factory()->comment->create_post_comments($p1, 1); |
| 1867 |
|
$c2 = self::factory()->comment->create_post_comments($p2, 1); |
| 1868 |
|
|
| 1869 |
|
$q = new WP_Comment_Query(); |
| 1870 |
|
$found = $q->query( |
| 1871 |
|
array( |
| 1872 |
|
'fields' => 'ids', |
| 1873 |
|
'post_type' => array( 'post-type-2' ), |
| 1874 |
|
) |
| 1875 |
|
); |
| 1876 |
|
|
| 1877 |
|
$this->assertEqualSets($c2, $found); |
| 1878 |
|
|
| 1879 |
|
_unregister_post_type('post-type-1'); |
| 1880 |
|
_unregister_post_type('post-type-2'); |
| 1881 |
|
} |