Skip to content

Commit b9df30a

Browse files
committed
Fully tested standard classes
1 parent 67749d9 commit b9df30a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/phpunit/TestMslsPostTag.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public function test_add_input(): void {
151151
Functions\expect( 'get_admin_url' )->atLeast()->once()->andReturn( '/wp-admin/edit-tags.php' );
152152
Functions\expect( 'get_term' )->atLeast()->once()->andReturnNull();
153153

154+
Actions\expectDone( MslsPostTag::ADD_ACTION );
155+
154156
$output = '<div class="form-field"><h3>Multisite Language Switcher</h3>
155157
<input type="hidden" name="msls_post_type" id="msls_post_type" value="post"/>
156158
<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>
@@ -162,6 +164,9 @@ public function test_add_input(): void {
162164
$this->expectOutputString( $output );
163165

164166
$this->test->add_input( 'test' );
167+
168+
// second call should not output anything
169+
$this->test->add_input( 'test' );
165170
}
166171

167172
public function test_the_input_no_blogs(): void {

tests/phpunit/TestMslsPostTagClassic.php

Lines changed: 8 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;
@@ -77,6 +78,8 @@ public function test_edit_input(): void {
7778

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

81+
Actions\expectDone( MslsPostTagClassic::EDIT_ACTION );
82+
8083
$output = '<tr>
8184
<th colspan="2">
8285
<strong>Multisite Language Switcher</strong>
@@ -137,6 +140,8 @@ public function test_add_input(): void {
137140

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

143+
Actions\expectDone( MslsPostTagClassic::ADD_ACTION );
144+
140145
$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>
141146
<select class="msls-translations" name="msls_input_de_DE">
142147
<option value=""></option>
@@ -150,6 +155,9 @@ public function test_add_input(): void {
150155
$this->expectOutputString( $output );
151156

152157
$this->test->add_input( 'test' );
158+
159+
// second call should not output anything
160+
$this->test->add_input( 'test' );
153161
}
154162

155163
public function test_the_input_no_blogs(): void {

0 commit comments

Comments
 (0)