Skip to content

Commit

Permalink
Completing test for pull method, #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zane Kolnik committed Oct 21, 2016
1 parent d5173ea commit eb55dfc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/php/NetworkSiteConnectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,39 @@ public function test_push(){

}

/**
* Pull returns an array of Post IDs on success. This test simulates sending an
* array containing three IDs (integers) will receive an array containing
* three integers.
*
* @since 0.8
* @return
*/
public function test_pull(){

$this->connection_obj->site->blog_id = 2;

\WP_Mock::userFunction( 'get_permalink' );

\WP_Mock::userFunction( 'get_post_meta', [
'return' => (object) [
'key' => []
]
] );

\WP_Mock::userFunction( 'get_post', [
'return' => (object) [
'post_tite' => 'My post title',
'meta' => [],
]
] );

\WP_Mock::userFunction( 'wp_insert_post', [
'return' => [4, 3, 2]
] );

$this->assertTrue( count( $this->connection_obj->pull( [ 2, 3, 4 ] ) ) === 3 );

}

}

0 comments on commit eb55dfc

Please sign in to comment.