Skip to content

Commit 1692d7e

Browse files
committed
MslsCustomColumn tested
1 parent 2639e24 commit 1692d7e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/phpunit/TestMslsCustomColumn.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,25 @@ public function test_th_empty(): void {
100100
public function test_td(): void {
101101
$item_id = 42;
102102

103+
$post_type = \Mockery::mock( MslsPostType::class );
104+
$post_type->shouldReceive( 'is_taxonomy' )->times( 3 )->andReturnFalse();
105+
$post_type->shouldReceive( 'get_request' )->twice()->andReturn( 'post' );
106+
107+
Functions\expect( 'get_current_blog_id' )->twice()->andReturn( 13 );
108+
Functions\expect( 'get_blog_option' )->once()->andReturn( 'de_DE' );
109+
Functions\expect( 'is_admin' )->once()->andReturnTrue();
110+
Functions\expect( 'msls_content_types' )->times( 3 )->andReturn( $post_type );
111+
Functions\expect( 'get_option' )->once()->andReturn( array( 'de_DE' => 17 ) );
112+
Functions\expect( 'switch_to_blog' )->twice();
113+
Functions\expect( 'restore_current_blog' )->twice();
114+
Functions\expect( 'get_edit_post_link' )->once()->andReturn( 'edit-post-link' );
115+
Functions\expect( 'add_query_arg' )->once()->andReturn( 'added-query-args' );
116+
Functions\expect( 'get_admin_url' )->once()->andReturn( 'admin-url' );
117+
118+
$output = '<span class="msls-icon-wrapper flag"><a title="Edit the translation in the de_DE-blog" href="edit-post-link"><span class="dashicons dashicons-edit"></span></a>&nbsp;</span><span class="msls-icon-wrapper flag"><a title="Create a new translation in the en_US-blog" href="admin-url"><span class="dashicons dashicons-plus"></span></a>&nbsp;</span>';
119+
120+
$this->expectOutputString( $output );
121+
103122
$this->test->td( 'mslscol', $item_id );
104123
}
105124
}

0 commit comments

Comments
 (0)