tests/util/HeaderNormalizerTest.php
/**
     * @covers ::normalize
     * @covers ::unshiftPatternReplacement
     * @testdox test to replace some special chars with addPatterns and setPatterns
     */
@covers ::normalize
@covers ::unshiftPatternReplacement
@testdox test to replace some special chars with addPatterns and setPatterns
@covers :: normalize @covers :: unshiftPatternReplacement @testdox test to replace some special chars with addPatterns and setPatterns
public function testNormalizeWithSetOwnPatterns(): void
    {
        $stringToNormalize = 'Foo!Bar-3+one';
        $expectedString = 'Foo_a_Bar_three_one';
        $patterns = ['/!/', '/3/'];
        $replacement = ['_a_', 'three'];
        $this->assertNotSame(
            $expectedString,
            (new HeaderNormalizer())->pushPatternReplacement($patterns, $replacement)->normalize($stringToNormalize)
        );
        $this->assertSame(
            $expectedString,
            (new HeaderNormalizer())
                ->unshiftPatternReplacement($patterns, $replacement)
                ->normalize($stringToNormalize)
        );
    }
public function testNormalizeWithSetOwnPatterns ( ) : void { $ stringToNormalize = 'Foo!Bar-3+one' ; $ expectedString = 'Foo_a_Bar_three_one' ; $ patterns = [ '/!/' , '/3/' ] ; $ replacement = [ '_a_' , 'three' ] ; $ this -> assertNotSame ( $ expectedString , ( new HeaderNormalizer ( ) ) -> pushPatternReplacement ( $ patterns , $ replacement ) -> normalize ( $ stringToNormalize ) ) ; $ this -> assertSame ( $ expectedString , ( new HeaderNormalizer ( ) ) -> unshiftPatternReplacement ( $ patterns , $ replacement ) -> normalize ( $ stringToNormalize ) ) ; }
@covers ::normalize
 @covers ::unshiftPatternReplacement
 @testdox test to replace some special chars with addPatterns and setPatterns
@covers :: normalize @covers :: unshiftPatternReplacement @testdox test to replace some special chars with addPatterns and setPatterns
// Be aware that pushPatternReplacement will merge the custom patterns to end of array and special chars // were replaced before with default pattern/replacement so that this test will fail // Instead of using pushPatternReplacement you can use unshiftPatternReplacement