/** * @expectedException \OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException */ public function testCreateHeaderFailed() { $header = array('header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo'); $em = $this->getMock('\\OCP\\Encryption\\IEncryptionModule'); $em->expects($this->any())->method('getId')->willReturn('moduleId'); $this->util->createHeader($header, $em); }
/** * write header at beginning of encrypted file * * @return integer * @throws EncryptionHeaderKeyExistsException if header key is already in use */ protected function writeHeader() { $header = $this->util->createHeader($this->newHeader, $this->encryptionModule); return parent::stream_write($header); }