Skip to content

Commit dcfe857

Browse files
committed
Tests for MslsPostTags added
1 parent bc9e312 commit dcfe857

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/phpunit/TestMslsPostTag.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace lloc\MslsTests;
44

55
use Brain\Monkey\Functions;
6+
use Brain\Monkey\Actions;
67
use lloc\Msls\MslsBlog;
78
use lloc\Msls\MslsBlogCollection;
89
use lloc\Msls\MslsOptions;
@@ -34,6 +35,28 @@ protected function setUp(): void {
3435
$this->test = new MslsPostTag( $options, $collection );
3536
}
3637

38+
public function test_init() {
39+
$options = \Mockery::mock( MslsOptions::class );
40+
$options->activate_autocomplete = true;
41+
42+
$collection = \Mockery::mock( MslsBlogCollection::class );
43+
44+
$taxonomy = \Mockery::mock( MslsTaxonomy::class );
45+
$taxonomy->shouldReceive( 'acl_request' )->once()->andReturn( 'post_tag' );
46+
47+
Functions\expect( 'msls_options' )->atLeast()->once()->andReturn( $options );
48+
Functions\expect( 'msls_blog_collection' )->atLeast()->once()->andReturn( $collection );
49+
Functions\expect( 'msls_content_types' )->atLeast()->once()->andReturn( $taxonomy );
50+
51+
Actions\expectAdded( 'post_tag_edit_form_fields' )->once();
52+
Actions\expectAdded( 'post_tag_add_form_fields' )->once();
53+
Actions\expectAdded( 'edited_post_tag' )->once();
54+
Actions\expectAdded( 'create_post_tag' )->once();
55+
56+
$this->expectNotToPerformAssertions();
57+
MslsPostTag::init();
58+
}
59+
3760
/**
3861
* Verify the static suggest-method
3962
*/

0 commit comments

Comments
 (0)