Skip to content

Bugfix #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions includes/Component/Icon/IconLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* Class IconLabel
*
* @package lloc\Msls\Component
*/
class IconLabel extends Icon {
Expand All @@ -24,11 +25,6 @@ protected function get_include(): string {
* @return string
*/
public function get( string $language ): string {
// if ( isset( $this->map[ $language ] ) ) {
// return $this->map[ $language ];
// }

return '<span>' . implode( '</span><span>', explode( '_', $language ) ) . '</span>';
}

}
}
2 changes: 1 addition & 1 deletion includes/MslsAdminIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function get_icon(): string {
$icon = sprintf(
'<span class="language-badge %s">%s</span>',
esc_attr( $this->language ),
esc_html( $text )
wp_kses( $text, array( 'span' => array() ) )
);
break;
default:
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/MslsUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected function setUp(): void {
Functions\when( 'esc_attr' )->returnArg();
Functions\when( 'esc_url' )->returnArg();
Functions\when( '__' )->returnArg();
Functions\when( 'wp_kses' )->returnArg();
}


Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/TestMslsAdminIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function icon_type_provider(): array {
* @dataProvider icon_type_provider
*/
public function test_get_icon_flag( ?string $icon_type, ?string $language, string $expected ): void {
Functions\expect( 'plugin_dir_path' )->atLeast( 1 )->andReturn( dirname( __DIR__, 2 ) . '/' );
Functions\expect( 'plugin_dir_path' )->andReturn( dirname( __DIR__, 2 ) . '/' );

$obj = new MslsAdminIcon( 'post' );
$obj->set_icon_type( $icon_type );
Expand Down
11 changes: 3 additions & 8 deletions tests/phpunit/TestMslsPostTagClassic.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ protected function setUp(): void {

foreach ( array( 'de_DE', 'en_US' ) as $locale ) {
$blog = \Mockery::mock( MslsBlog::class );
$blog->shouldReceive(
array(
'get_language' => $locale,
)
);
$blog->shouldReceive( 'get_language' )->andReturn( $locale );

$blogs[] = $blog;
}
Expand Down Expand Up @@ -54,10 +50,9 @@ public function test_edit_input(): void {
Functions\expect( 'get_queried_object_id' )->andReturn( 42 );
Functions\expect( 'get_current_blog_id' )->andReturn( 23 );
Functions\expect( 'get_admin_url' )->andReturn( '/wp-admin/edit-tags.php' );
Functions\expect( 'switch_to_blog' )->atLeast();
Functions\expect( 'restore_current_blog' )->atLeast();
Functions\expect( 'switch_to_blog' )->twice();
Functions\expect( 'restore_current_blog' )->twice();
Functions\expect( 'get_terms' )->andReturn( array() );
Functions\expect( 'plugin_dir_path' )->atLeast( 1 )->andReturn( dirname( __DIR__, 1 ) . '/' );
Functions\expect( 'is_woocommerce' )->once()->andReturn( false );

$output = '<tr>
Expand Down
Loading