<commit_before><?php

namespace Athens\Encryption\Test;

use PHPUnit_Framework_TestCase;

use UWDOEM\SecureUploads\Cipher;


class CipherTest extends PHPUnit_Framework_TestCase
{
    public function testEncryptDecrypt()
    {
        $word = str_shuffle('abcdef');

        $data = str_repeat($word, rand(10, 30));
        for($i = 0; $i < 100; $i++) {
            $data .= str_shuffle('abcdefeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
        }

        $filename = md5(rand()) . '.txt';
        $fileLocation = __DIR__ . '/tmp/' . $filename;

        file_put_contents($fileLocation, $data);

        $_FILES['test-data'] = [
            'tmp_name' => $fileLocation,
            'name' => $filename,
        ];

        $location = Cipher::encrypt('test-data', __DIR__ . '/tmp', __DIR__ . '/certs/publickey.cer');

        if (!is_dir(__DIR__ . '/tmp')) {
            mkdir(__DIR__ . '/tmp');
        }

        if (!is_dir(__DIR__ . '/tmp/out')) {
            mkdir(__DIR__ . '/tmp/out');
        }

        Cipher::decrypt($location, __DIR__ . '/tmp/out/' , __DIR__ . '/certs/privatekey.pem');

        // Delete everything in the tmp directory
        array_map('unlink', glob(__DIR__ . "/tmp/out/*"));
        rmdir(__DIR__ . '/tmp/out');
        array_map('unlink', glob(__DIR__ . "/tmp/*"));
        rmdir(__DIR__ . '/tmp');
    }
}
<commit_msg>Satisfy travis.<commit_after><?php

namespace Athens\Encryption\Test;

use PHPUnit_Framework_TestCase;

use UWDOEM\SecureUploads\Cipher;


class CipherTest extends PHPUnit_Framework_TestCase
{
    public function testEncryptDecrypt()
    {
        if (!is_dir(__DIR__ . '/tmp')) {
            mkdir(__DIR__ . '/tmp');
        }

        if (!is_dir(__DIR__ . '/tmp/out')) {
            mkdir(__DIR__ . '/tmp/out');
        }
        
        $word = str_shuffle('abcdef');

        $data = str_repeat($word, rand(10, 30));
        for($i = 0; $i < 100; $i++) {
            $data .= str_shuffle('abcdefeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
        }

        $filename = md5(rand()) . '.txt';
        $fileLocation = __DIR__ . '/tmp/' . $filename;

        file_put_contents($fileLocation, $data);

        $_FILES['test-data'] = [
            'tmp_name' => $fileLocation,
            'name' => $filename,
        ];

        $location = Cipher::encrypt('test-data', __DIR__ . '/tmp', __DIR__ . '/certs/publickey.cer');

        Cipher::decrypt($location, __DIR__ . '/tmp/out/' , __DIR__ . '/certs/privatekey.pem');

        // Delete everything in the tmp directory
        array_map('unlink', glob(__DIR__ . "/tmp/out/*"));
        rmdir(__DIR__ . '/tmp/out');
        array_map('unlink', glob(__DIR__ . "/tmp/*"));
        rmdir(__DIR__ . '/tmp');
    }
}

{'fraction_non_alphanumeric': 0.16824127906976744, 'fraction_numerical': 0.013808139534883721, 'mean_word_length': 2.2734839476813318, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2182770', 'n_tokens_mistral': 972, 'n_tokens_neox': 908, 'n_words': 157}