public function testTranscode() { $encodedValue = 'encoded'; $decodedValue = 'decoded'; $transcodedValue = 'transcoded'; $this->decoderMock->decode($encodedValue)->willReturn($decodedValue); $this->encoderMock->encode($decodedValue)->willReturn($transcodedValue); $result = $this->transcoder->transcode($encodedValue); $this->assertSame($transcodedValue, $result); }
public function testTranscoderWasCreatedWithCreatedFactories() { $this->encoderResolverMock->resolve('encode')->willReturn($this->encoderMock); $this->decoderResolverMock->resolve('decode')->willReturn($this->decoderMock); $this->encoderMock->encode(Argument::any())->shouldBeCalled(); $this->decoderMock->decode(Argument::any())->shouldBeCalled(); $transcoder = $this->transcoderFactory->createTranscoder('decode', 'encode'); $transcoder->transcode('data'); }
/** * @param $data string * @return string */ public function transcode($data) { $data = $this->decoder->decode($data); $data = $this->encoder->encode($data); return $data; }