diff --git a/includes/Component/Icon/IconLabel.php b/includes/Component/Icon/IconLabel.php index 5fb56bf6..49151fca 100644 --- a/includes/Component/Icon/IconLabel.php +++ b/includes/Component/Icon/IconLabel.php @@ -7,6 +7,7 @@ /** * Class IconLabel + * * @package lloc\Msls\Component */ class IconLabel extends Icon { @@ -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 '' . implode( '', explode( '_', $language ) ) . ''; } - -} \ No newline at end of file +} diff --git a/includes/MslsAdminIcon.php b/includes/MslsAdminIcon.php index cae79669..7785dcdc 100644 --- a/includes/MslsAdminIcon.php +++ b/includes/MslsAdminIcon.php @@ -243,7 +243,7 @@ public function get_icon(): string { $icon = sprintf( '%s', esc_attr( $this->language ), - esc_html( $text ) + wp_kses( $text, array( 'span' => array() ) ) ); break; default: diff --git a/tests/phpunit/MslsUnitTestCase.php b/tests/phpunit/MslsUnitTestCase.php index 030ba7ca..2fbb62cc 100644 --- a/tests/phpunit/MslsUnitTestCase.php +++ b/tests/phpunit/MslsUnitTestCase.php @@ -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(); } diff --git a/tests/phpunit/TestMslsAdminIcon.php b/tests/phpunit/TestMslsAdminIcon.php index 09c75fec..3f5a0c50 100644 --- a/tests/phpunit/TestMslsAdminIcon.php +++ b/tests/phpunit/TestMslsAdminIcon.php @@ -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 ); diff --git a/tests/phpunit/TestMslsPostTagClassic.php b/tests/phpunit/TestMslsPostTagClassic.php index f83eb7f0..38499c54 100644 --- a/tests/phpunit/TestMslsPostTagClassic.php +++ b/tests/phpunit/TestMslsPostTagClassic.php @@ -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; } @@ -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 = '