/** * Test encryption attempt with invalid key * * @expectedException \Gtt\Bundle\CryptBundle\Exception\SymmetricEncryptionException * @expectedExceptionMessage Cannot safely perform decryption */ public function testCannotPerformOperation() { $this->keyReader->expects($this->once())->method('read')->willReturn(''); $encryptor = new AesEncryptor($this->keyReader, true); $encryptor->encrypt(Fixtures::PLAIN_TEXT); }
/** * {@inheritdoc} */ protected function setUp() { $this->keyReader = $this->getMockBuilder('Gtt\\Bundle\\CryptBundle\\Bridge\\Aes\\KeyReader')->disableOriginalConstructor()->getMock(); $this->keyReader->expects($this->once())->method('read')->willReturn(Fixtures::key()); }