assertEquals( $similarity, 0.775 ); $this->assertEquals( $similarity_2, 1 ); } /** * @dataProvider data_attributes_with_entities */ function test_gp_esc_attr_with_entities( $expected, $attribute ) { $this->assertEquals( $expected, gp_esc_attr_with_entities( $attribute ) ); } function data_attributes_with_entities() { return array( array( '&#8212;', '—' ), // https://glotpress.trac.wordpress.org/ticket/12 array( 'Foo & Bar', 'Foo & Bar' ), array( '"&hellip;"', '"…"' ), ); } /** * @dataProvider data_translations_with_entities */ function test_esc_translation( $expected, $translation ) { $this->assertEquals( $expected, esc_translation( $translation ) ); } function data_translations_with_entities() { return array( array( 'Foo bar&hellip;', 'Foo bar…' ), array( 'Foo <span class="count">(%s)</span>', 'Foo (%s)' ), array( '"&hellip;"', '"…"' ), ); } function test_gp_sanitize_project_name() { $this->assertEquals( gp_sanitize_slug( 'plugin V1.2.1' ), 'plugin-v1.2.1' ); $this->assertEquals( gp_sanitize_slug( 'plugin \/<1.2.1>' ), 'plugin' ); $this->assertEquals( gp_sanitize_slug( 'GlotPress&Plugin@1.1.1' ), 'glotpressplugin1.1.1' ); } }