<commit_before><?php

namespace Geocoder\Tests\CacheAdapter;

use Geocoder\CacheAdapter\Filesystem;
use Geocoder\Tests\TestCase;

/**
 * @author <NAME> <<EMAIL>>
 */
class FilesystemTest extends TestCase
{
    /**
     * @dataProvider getCacheData
     */
    public function testRetrieveAndStore($key, $value)
    {
        $cache = new Filesystem(sys_get_temp_dir());
        $this->assertNull($cache->retrieve($key));
        $cache->store($key, $value);
        $this->assertEquals($value, $cache->retrieve($key));
    }

    static public function getCacheData()
    {
        return array(
            array('1', null),
            array('2', 'bar'),
            array('3', new \Geocoder\Result\Geocoded()),
            array('4', array('foo', 'bar')),
            array('5', 1),
            array('6', 2.1)
        );
    }
}<commit_msg>update unit test<commit_after><?php

namespace Geocoder\Tests\CacheAdapter;

use Geocoder\CacheAdapter\Filesystem;
use Geocoder\Tests\TestCase;

/**
 * @author <NAME> <<EMAIL>>
 */
class FilesystemTest extends TestCase
{

    protected function setUp()
    {
        $this->path = sys_get_temp_dir() . '/geocoder/filesystem_test';
        if (!file_exists($this->path)) {
            mkdir($this->path, 0777, true);
        }
    }

    protected function tearDown()
    {
        array_map('unlink', glob($this->path.'/*.cache'));
        rmdir($this->path);
        $this->path = null;
    }

    /**
     * @dataProvider getCacheData
     */
    public function testRetrieveAndStore($key, $value)
    {
        $cache = new Filesystem($this->path);
        $this->assertNull($cache->retrieve($key));
        $cache->store($key, $value);
        $this->assertEquals($value, $cache->retrieve($key));
    }

    static public function getCacheData()
    {
        return array(
            array('1', null),
            array('2', 'bar'),
            array('3', new \Geocoder\Result\Geocoded()),
            array('4', array('foo', 'bar')),
            array('5', 1),
            array('6', 2.1)
        );
    }
}
{'fraction_non_alphanumeric': 0.17055393586005832, 'fraction_numerical': 0.010689990281827016, 'mean_word_length': 2.3263327948303716, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 26, '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': '5895750', 'n_tokens_mistral': 649, 'n_tokens_neox': 635, 'n_words': 117}