<commit_before><?php

namespace WeiTest;

/**
 * @internal
 */
final class NearCacheTest extends CacheTestCase
{
}<commit_msg>test(NearCache): 增加 get，set 测试<commit_after><?php

namespace WeiTest;

use Wei\NearCache;

/**
 * @internal
 * @property NearCache $object
 */
final class NearCacheTest extends CacheTestCase
{
    public function testGetFromFront()
    {
        $time = time();

        $this->object->getFront()->set(__FUNCTION__, $time);
        $this->object->getBack()->delete(__FUNCTION__);

        $this->assertSame($time, $this->object->get(__FUNCTION__));
    }

    public function testGetFromBack()
    {
        $time = time();

        $this->object->getFront()->delete(__FUNCTION__);
        $this->object->getBack()->set(__FUNCTION__, $time);

        $this->assertSame($time, $this->object->get(__FUNCTION__));

        $this->assertSame($time, $this->object->getFront()->get(__FUNCTION__));
    }

    public function testSetBoth()
    {
        $time = time();
        $this->object->set(__FUNCTION__, $time);

        $front = $this->object->getFront();
        $back = $this->object->getFront();

        $this->assertSame($time, $front->get(__FUNCTION__));
        $this->assertSame($time, $back->get(__FUNCTION__));
    }
}
{'fraction_non_alphanumeric': 0.17768924302788844, 'fraction_numerical': 0.0, 'mean_word_length': 3.2432432432432434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '4526778', 'n_tokens_mistral': 385, 'n_tokens_neox': 375, 'n_words': 63}