Skip to content

Commit

Permalink
add test case for #273
Browse files Browse the repository at this point in the history
  • Loading branch information
scribu committed Nov 23, 2012
1 parent 59fde2d commit 93167a6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_core.php
Expand Up @@ -583,6 +583,23 @@ function test_any() {
$this->assertEmpty( $connected_users->items );
}

function test_non_connectable() {
$ctype = p2p_type( 'posts_to_users' );

$user = $this->generate_user();

$posts = $this->factory->post->create_many( get_option( 'posts_per_page' ) );
$more_posts = $this->factory->post->create_many( 2 );

foreach ( $posts as $post ) {
$ctype->connect( $user, $post );
}

$candidate = $ctype->get_connectable( $user, array(), 'abstract' );

$this->assertEqualSets( $more_posts, wp_list_pluck( $candidate->items, 'ID' ) );
}

private function generate_posts( $type, $count ) {
return $this->factory->post->create_many( $count, array(
'post_type' => $type
Expand Down

0 comments on commit 93167a6

Please sign in to comment.