/**
  * Test regular key reading
  */
 public function testReadSuccess()
 {
     $extra = '123';
     file_put_contents($this->filename, Fixtures::key() . $extra, LOCK_EX);
     $subject = new KeyReader($this->filename);
     $this->assertEquals(Fixtures::key(), $subject->read());
 }
 /**
  * Test encrypt with base64 encoding
  */
 public function testEncryptBase64()
 {
     $this->keyReader->expects($this->once())->method('read')->willReturn(Fixtures::key());
     $encryptor = new AesEncryptor($this->keyReader, false);
     $ciphertext = $encryptor->encrypt(Fixtures::PLAIN_TEXT);
     $this->assertNotEmpty($ciphertext);
     $this->assertNotEmpty(base64_decode($ciphertext));
 }
 /**
  * {@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());
 }