Skip to content

Commit

Permalink
Tests for MslsPostTags added
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc committed Sep 6, 2024
1 parent bc9e312 commit dcfe857
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/phpunit/TestMslsPostTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace lloc\MslsTests;

use Brain\Monkey\Functions;
use Brain\Monkey\Actions;
use lloc\Msls\MslsBlog;
use lloc\Msls\MslsBlogCollection;
use lloc\Msls\MslsOptions;
Expand Down Expand Up @@ -34,6 +35,28 @@ protected function setUp(): void {
$this->test = new MslsPostTag( $options, $collection );
}

public function test_init() {
$options = \Mockery::mock( MslsOptions::class );
$options->activate_autocomplete = true;

$collection = \Mockery::mock( MslsBlogCollection::class );

$taxonomy = \Mockery::mock( MslsTaxonomy::class );
$taxonomy->shouldReceive( 'acl_request' )->once()->andReturn( 'post_tag' );

Functions\expect( 'msls_options' )->atLeast()->once()->andReturn( $options );
Functions\expect( 'msls_blog_collection' )->atLeast()->once()->andReturn( $collection );
Functions\expect( 'msls_content_types' )->atLeast()->once()->andReturn( $taxonomy );

Actions\expectAdded( 'post_tag_edit_form_fields' )->once();
Actions\expectAdded( 'post_tag_add_form_fields' )->once();
Actions\expectAdded( 'edited_post_tag' )->once();
Actions\expectAdded( 'create_post_tag' )->once();

$this->expectNotToPerformAssertions();
MslsPostTag::init();
}

/**
* Verify the static suggest-method
*/
Expand Down

0 comments on commit dcfe857

Please sign in to comment.