From 8c8a1bf3540a8e6031aef06d0427d8580b91b171 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 29 Jun 2020 21:42:23 -0400 Subject: [PATCH] posts connector completed --- .../connectors/test-class-connector-posts.php | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/tests/tests/connectors/test-class-connector-posts.php b/tests/tests/connectors/test-class-connector-posts.php index 899739297..f9fc5bfc8 100644 --- a/tests/tests/connectors/test-class-connector-posts.php +++ b/tests/tests/connectors/test-class-connector-posts.php @@ -43,10 +43,11 @@ public function test_callback_transition_post_status() { ) ), $this->greaterThan( 0 ), - 'post', - 'updated' + $this->equalTo( 'post' ), + $this->equalTo( 'updated' ) ); + // Do stuff wp_insert_post( array( 'post_title' => 'Test post', @@ -61,9 +62,39 @@ public function test_callback_transition_post_status() { } public function test_callback_deleted_post() { - $this->markTestIncomplete( - 'Not implemented yet.' + $post_id = wp_insert_post( + array( + 'post_title' => 'Test post', + 'post_content' => 'Lorem ipsum dolor...', + 'post_status' => 'publish' + ) ); + + $this->mock->expects( $this->atLeastOnce() ) + ->method( 'log' ) + ->with( + $this->equalTo( + _x( + '"%1$s" %2$s deleted from trash', + '1: Post title, 2: Post type singular name', + 'stream' + ) + ), + $this->equalTo( + array( + 'post_title' => 'Test post', + 'singular_name' => 'post', + ) + ), + $this->greaterThan( 0 ), + $this->equalTo( 'post' ), + $this->equalTo( 'deleted' ) + ); + + // Do stuff + wp_delete_post( $post_id, true ); + + $this->assertFalse( 0 === did_action( 'wp_stream_test_callback_deleted_post' ) ); } }