Code Duplication    Length = 12-13 lines in 3 locations

tests/test-ao.php 3 locations

@@ 2162-2173 (lines=12) @@
2159
        ];
2160
    }
2161
2162
    function test_mb_substr_replace_with_ascii_input_string()
2163
    {
2164
        autoptimizeUtils::mbstring_available( false );
2165
2166
        $str = 'Ascii';
2167
2168
        $this->assertSame( 'Añ', autoptimizeUtils::substr_replace( $str, 'ñ', 1 ) );
2169
        $this->assertSame( 'ñcii', autoptimizeUtils::substr_replace( $str, 'ñ', 0, 2 ) );
2170
        $this->assertSame( 'Asñx', autoptimizeUtils::substr_replace( $str, 'ñx', 2, 3 ) );
2171
        $this->assertSame( 'Asz', autoptimizeUtils::substr_replace( $str, 'z', 2, 10 ) );
2172
        $this->assertSame( 'Añii', autoptimizeUtils::substr_replace( $str, 'ñ', 1, 2 ) );
2173
    }
2174
2175
    function test_mb_substr_replace_with_utf8_input_string()
2176
    {
@@ 2175-2186 (lines=12) @@
2172
        $this->assertSame( 'Añii', autoptimizeUtils::substr_replace( $str, 'ñ', 1, 2 ) );
2173
    }
2174
2175
    function test_mb_substr_replace_with_utf8_input_string()
2176
    {
2177
        autoptimizeUtils::mbstring_available( true );
2178
2179
        $str = 'âønæë';
2180
2181
        $this->assertSame( 'âñ', autoptimizeUtils::substr_replace( $str, 'ñ', 1 ) ); // No length.
2182
        $this->assertSame( 'ñnæë', autoptimizeUtils::substr_replace( $str, 'ñ', 0, 2 ) );
2183
        $this->assertSame( 'âøñx', autoptimizeUtils::substr_replace( $str, 'ñx', 2, 3 ) );
2184
        $this->assertSame( 'âøz', autoptimizeUtils::substr_replace( $str, 'z', 2, 10 ) ); // Length larger than possible...
2185
        $this->assertSame( 'âñæë', autoptimizeUtils::substr_replace( $str, 'ñ', 1, 2 ) );
2186
    }
2187
2188
    function test_default_substr_replace_with_ascii_input_string()
2189
    {
@@ 2188-2200 (lines=13) @@
2185
        $this->assertSame( 'âñæë', autoptimizeUtils::substr_replace( $str, 'ñ', 1, 2 ) );
2186
    }
2187
2188
    function test_default_substr_replace_with_ascii_input_string()
2189
    {
2190
        // Disable mbstring which should fall ack to substr_replace...
2191
        autoptimizeUtils::mbstring_available( false );
2192
2193
        $str = 'Ascii';
2194
2195
        $this->assertSame( 'Añ', autoptimizeUtils::substr_replace( $str, 'ñ', 1 ) );
2196
        $this->assertSame( 'ñcii', autoptimizeUtils::substr_replace( $str, 'ñ', 0, 2 ) );
2197
        $this->assertSame( 'Asñx', autoptimizeUtils::substr_replace( $str, 'ñx', 2, 3 ) );
2198
        $this->assertSame( 'Asz', autoptimizeUtils::substr_replace( $str, 'z', 2, 10 ) );
2199
        $this->assertSame( 'Añii', autoptimizeUtils::substr_replace( $str, 'ñ', 1, 2 ) );
2200
    }
2201
2202
    function test_default_substr_replace_with_utf8_input_string()
2203
    {