/** * @return void */ public function testEncryptionInSameFile() { $filter = new FileEncrypt(); $filter->setKey('1234567890123456'); copy(dirname(__DIR__) . '/_files/encryption.txt', dirname(__DIR__) . '/_files/newencryption.txt'); $filter->filter(dirname(__DIR__) . '/_files/newencryption.txt'); $this->assertNotEquals('Encryption', trim(file_get_contents(dirname(__DIR__) . '/_files/newencryption.txt'))); }
public function testEncryptionWithDecryption() { $filter = new FileEncrypt(); $filter->setFilename(dirname(__DIR__) . '/_files/newencryption.txt'); $filter->setKey('1234567890123456'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption.txt', $filter->filter(dirname(__DIR__) . '/_files/encryption.txt')); $this->assertNotEquals('Encryption', file_get_contents(dirname(__DIR__) . '/_files/newencryption.txt')); $filter = new FileDecrypt(); $filter->setFilename(dirname(__DIR__) . '/_files/newencryption2.txt'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption2.txt', $filter->getFilename()); $filter->setKey('1234567890123456'); $input = $filter->filter(dirname(__DIR__) . '/_files/newencryption.txt'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption2.txt', $input); $this->assertEquals('Encryption', trim(file_get_contents(dirname(__DIR__) . '/_files/newencryption2.txt'))); }
/** * @dataProvider returnUnfilteredDataProvider * @return void */ public function testReturnUnfiltered($input) { $filter = new FileEncrypt(); $filter->setKey('1234567890123456'); $this->assertEquals($input, $filter($input)); }