public function it_encodes_to_json_as_a_string_representation_of_the_token(JwtDriverInterface $jwt) { $driver = new FirebaseDriver(); $jwt = new JwtToken($driver); $token = $jwt->createToken(['exp' => time() + 100], 'secret'); $serialized = json_encode(['token' => $token]); $decoded = json_decode($serialized); if (!is_string($decoded->token) || strlen($decoded->token) < 1) { throw new FailureException('Token was not json encoded.'); } }