public function parseMustReturnASignedTokenWhenSignatureIsInformed()
{
$this->decoder->expects($this->at(0))->method('base64UrlDecode')->with('a')->willReturn('a_dec');
$this->decoder->expects($this->at(1))->method('jsonDecode')->with('a_dec')->willReturn(['typ' => 'JWT', 'alg' => 'HS256']);
$this->decoder->expects($this->at(2))->method('base64UrlDecode')->with('b')->willReturn('b_dec');
$this->decoder->expects($this->at(3))->method('jsonDecode')->with('b_dec')->willReturn(['aud' => 'test']);
$this->decoder->expects($this->at(4))->method('base64UrlDecode')->with('c')->willReturn('c_dec');
$parser = $this->createParser();
$token = $parser->parse('a.b.c');
self::assertAttributeEquals(['typ' => 'JWT', 'alg' => 'HS256'], 'headers', $token);
self::assertAttributeEquals(['aud' => $this->defaultClaim], 'claims', $token);
self::assertAttributeEquals(new Signature('c_dec'), 'signature', $token);
self::assertAttributeEquals(['a', 'b', 'c'], 'payload', $token);
}