Skip to content

Commit

Permalink
Fully tested standard classes
Browse files Browse the repository at this point in the history
  • Loading branch information
lloc committed Nov 10, 2024
1 parent 67749d9 commit b9df30a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/phpunit/TestMslsPostTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public function test_add_input(): void {
Functions\expect( 'get_admin_url' )->atLeast()->once()->andReturn( '/wp-admin/edit-tags.php' );
Functions\expect( 'get_term' )->atLeast()->once()->andReturnNull();

Actions\expectDone( MslsPostTag::ADD_ACTION );

$output = '<div class="form-field"><h3>Multisite Language Switcher</h3>
<input type="hidden" name="msls_post_type" id="msls_post_type" value="post"/>
<input type="hidden" name="msls_action" id="msls_action" value="suggest_terms"/><label for="msls_title_"><a title="Create a new translation in the de_DE-blog" href="/wp-admin/edit-tags.php"><span class="language-badge de_DE"><span>de</span><span>DE</span></span></a>&nbsp;</label>
Expand All @@ -162,6 +164,9 @@ public function test_add_input(): void {
$this->expectOutputString( $output );

$this->test->add_input( 'test' );

// second call should not output anything
$this->test->add_input( 'test' );
}

public function test_the_input_no_blogs(): void {
Expand Down
8 changes: 8 additions & 0 deletions tests/phpunit/TestMslsPostTagClassic.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 @@ -77,6 +78,8 @@ public function test_edit_input(): void {

Functions\expect( 'msls_content_types' )->atLeast()->once()->andReturn( $taxonomy );

Actions\expectDone( MslsPostTagClassic::EDIT_ACTION );

$output = '<tr>
<th colspan="2">
<strong>Multisite Language Switcher</strong>
Expand Down Expand Up @@ -137,6 +140,8 @@ public function test_add_input(): void {

Functions\expect( 'msls_content_types' )->atLeast()->once()->andReturn( $taxonomy );

Actions\expectDone( MslsPostTagClassic::ADD_ACTION );

$output = '<div class="form-field"><h3>Multisite Language Switcher</h3><label for="msls_input_de_DE"><a title="Edit the translation in the de_DE-blog" href="edit_term_link"><span class="language-badge de_DE"><span>de</span><span>DE</span></span></a>&nbsp;</label>
<select class="msls-translations" name="msls_input_de_DE">
<option value=""></option>
Expand All @@ -150,6 +155,9 @@ public function test_add_input(): void {
$this->expectOutputString( $output );

$this->test->add_input( 'test' );

// second call should not output anything
$this->test->add_input( 'test' );
}

public function test_the_input_no_blogs(): void {
Expand Down

0 comments on commit b9df30a

Please sign in to comment.