Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
#41 attachment_unittest - fix test image
Browse files Browse the repository at this point in the history
  • Loading branch information
derpixler committed Jan 22, 2016
1 parent 839b498 commit 3eaf233
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion inc/Import/Service/WpPostImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ public function import_attachment( $attachment_id, Type\ImportPostInterface $imp
);



// Generate the metadata for the attachment, and update the database record.
$attachment_metadata = wp_generate_attachment_metadata( $attachment_id, $upload['file'] );
wp_update_attachment_metadata( $attachment_id, $attachment_metadata );
Expand Down
12 changes: 8 additions & 4 deletions tests/phpunit/Unit/Import/Service/WpAttachementImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ public function test_import_post() {

}

Brain\Monkey\Functions::expect( 'wp_insert_post' )
Brain\Monkey\Functions::expect( 'wp_insert_attachment' )
->atLeast()
->once()
->with(
$post,
TRUE
$postdata[ 'origin_attachment_url' ],
$new_parent_id
)
->andReturn( $post_id );

Expand Down Expand Up @@ -238,6 +239,8 @@ public function test_import_post() {
->willReturn( $request_testdata );


Brain\Monkey\Functions::expect( 'wp_update_post' )->times( 1 );

Brain\Monkey\Functions::expect( 'wp_generate_attachment_metadata' )
->atLeast()
->once()
Expand All @@ -247,8 +250,9 @@ public function test_import_post() {
)
);

Brain\Monkey\Functions::expect( 'wp_update_attachment_metadata' )->times( 1 );

Brain\Monkey\Functions::expect( 'wp_update_attachment_metadata' )
->atLeast()
->once();

$testee->import_post( $post_mock );

Expand Down

0 comments on commit 3eaf233

Please sign in to comment.