public function testMessageEncryptionMessageTextClass()
 {
     $messageEncryption = new MessageEncryption($this->encryption, $this->userKey, 'Claudusd\\SecureChat\\Tests\\Model\\MessageText');
     $user = new User();
     $encryptionAES = new EncryptionAES256();
     $sha1 = new SHA1();
     $generateKeyRSA4096 = new GenerateKeyRSA4096();
     $key = 'my key';
     $this->userKey->encryptKey($user, $key);
     $messageText = $messageEncryption->encryptMessage($user, 'toto');
     $messageEncryption->decryptMessage($messageText, $key);
     $reflectionMethod = new \ReflectionMethod('Claudusd\\SecureChat\\Tests\\Model\\MessageText', 'setUser');
     $reflectionMethod->setAccessible(true);
     $reflectionMethod->invoke($messageText, new User());
     try {
         $messageEncryption->decryptMessage($messageText, $key);
         $this->fail('An expected exception of type EncryptionException has not been raised.');
     } catch (EncryptionException $expected) {
     }
 }
 public function testSerializationMessage()
 {
     $messageEncryption = new MessageEncryption($this->encryption, $this->userKey, 'Claudusd\\SecureChat\\Tests\\Model\\MessageText');
     $user = new User();
     $key = 'my key';
     $this->userKey->encryptKey($user, $key);
     $messageText = $messageEncryption->encryptMessage($user, 'toto');
     $json = $this->serializer->serializerMessage($messageText);
     $json_decode = json_decode($json, true);
     $this->assertEquals(utf8_encode($messageText->getMessage()), $json_decode['message']);
     $this->assertEquals($messageText->getMessage(), utf8_decode($json_decode['message']));
     try {
         $this->serializer->serializerMessage(null);
         $this->fail('An expected exception of type InvalidArgumentException has not been raised.');
     } catch (\InvalidArgumentException $e) {
     }
     try {
         $this->serializer->serializerMessage($user);
         $this->fail('An expected exception of type InvalidArgumentException has not been raised.');
     } catch (\InvalidArgumentException $e) {
     }
 }