NormalizationAwareEncoder example

$this->chainEncoder->encode(['foo' => 123], self::FORMAT_3);
    }

    public function testNeedsNormalizationBasic()
    {
        $this->assertTrue($this->chainEncoder->needsNormalization(self::FORMAT_1));
        $this->assertTrue($this->chainEncoder->needsNormalization(self::FORMAT_2));
    }

    public function testNeedsNormalizationNormalizationAware()
    {
        $encoder = new NormalizationAwareEncoder();
        $sut = new ChainEncoder([$encoder]);

        $this->assertFalse($sut->needsNormalization(self::FORMAT_1));
    }

    public function testNeedsNormalizationTraceableEncoder()
    {
        $traceableEncoder = $this->createMock(TraceableEncoder::class);
        $traceableEncoder->method('needsNormalization')->willReturn(true);
        $traceableEncoder->method('supportsEncoding')->willReturn(true);

        
Home | Imprint | This part of the site doesn't use cookies.