/** * Ensures that the filter follows expected behavior * * @return void */ public function testBasic() { $filter = new FileEncrypt(); $filter->setFilename(dirname(__DIR__) . '/_files/newencryption.txt'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption.txt', $filter->getFilename()); $filter->setVector('testvect'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption.txt', $filter(dirname(__DIR__) . '/_files/encryption.txt')); $this->assertEquals('Encryption', file_get_contents(dirname(__DIR__) . '/_files/encryption.txt')); $this->assertNotEquals('Encryption', file_get_contents(dirname(__DIR__) . '/_files/newencryption.txt')); }
/** * Ensures that the filter follows expected behavior * * @return void */ public function testBasic() { $filter = new FileEncrypt(); $filter->setFilename(dirname(__DIR__) . '/_files/newencryption.txt'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption.txt', $filter->getFilename()); $filter->setKey('1234567890123456'); $filter->filter(dirname(__DIR__) . '/_files/encryption.txt'); $filter = new FileDecrypt(); $this->assertNotEquals('Encryption', file_get_contents(dirname(__DIR__) . '/_files/newencryption.txt')); $filter->setKey('1234567890123456'); $this->assertEquals(dirname(__DIR__) . '/_files/newencryption.txt', $filter->filter(dirname(__DIR__) . '/_files/newencryption.txt')); $this->assertEquals('Encryption', trim(file_get_contents(dirname(__DIR__) . '/_files/newencryption.txt'))); }