From 0e92515a31c61c0dda904c16044a5c37174d7305 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Mon, 16 Sep 2024 11:04:40 +0200 Subject: [PATCH] Set method tested --- tests/phpunit/TestMslsPostTag.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/phpunit/TestMslsPostTag.php b/tests/phpunit/TestMslsPostTag.php index 597ba8ef..48b1b32a 100644 --- a/tests/phpunit/TestMslsPostTag.php +++ b/tests/phpunit/TestMslsPostTag.php @@ -31,6 +31,8 @@ protected function setUp(): void { $collection = \Mockery::mock( MslsBlogCollection::class ); $collection->shouldReceive( 'get' )->andReturn( $blogs ); + $collection->shouldReceive( 'has_current_blog' )->andReturnTrue(); + $collection->shouldReceive( 'get_current_blog' )->andReturn( $blogs[0] ); $this->test = new MslsPostTag( $options, $collection ); } @@ -163,4 +165,17 @@ public function test_the_input_no_blogs(): void { $this->assertFalse( $value ); } + + public function test_set() { + $taxonomy = \Mockery::mock( MslsTaxonomy::class ); + $taxonomy->shouldReceive( 'acl_request' )->once()->andReturn( 'post_tag' ); + + Functions\expect( 'msls_content_types' )->once()->andReturn( $taxonomy ); + Functions\expect( 'delete_option' )->twice(); + Functions\expect( 'switch_to_blog' )->twice(); + Functions\expect( 'restore_current_blog' )->twice(); + + $this->expectNotToPerformAssertions(); + $this->test->set( 42 ); + } }