コード例 #1
0
 /**
  * test decode
  */
 public function testDecode()
 {
     $dispatcher = $this->getEventDispatcherMock();
     $dispatcher->expects($this->once())->method('dispatch')->with($this->equalTo(Events::JWT_DECODED), $this->isInstanceOf('Lexik\\Bundle\\JWTAuthenticationBundle\\Event\\JWTDecodedEvent'));
     $encoder = $this->getJWTEncoderMock();
     $encoder->expects($this->once())->method('decode')->willReturn(array('foo' => 'bar'));
     $manager = new JWTManager($encoder, $dispatcher, 3600);
     $this->assertEquals(array('foo' => 'bar'), $manager->decode($this->getJWTUserTokenMock()));
 }