<commit_before><?php

namespace Zie\DeviceDetector\Tests\CacheProvider;

use Zie\DeviceDetector\CacheProvider\PredisProvider;
use Zie\DeviceDetector\Tests\TestCase\CacheProviderTestCase;

/**
 * Class PredisProviderTest
 * @package Zie\DeviceDetector\Tests\CacheProvider
 */
class PredisProviderTest extends CacheProviderTestCase
{
    /**
     * @var \Predis\Redis
     */
    private $predis;

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        if(!class_exists('\Predis\Redis')) {
            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of predis/predis component.');
        }

        $this->predis = new \Predis\Redis();
        try {
            $this->predis->connect();
        } catch (\Predis\Connection\ConnectionException $e) {
            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis');
        }
    }

    public function tearDown()
    {
        if ($this->predis instanceof \Predis\Redis) {
            $this->predis->flushdb();
        }
    }

    /**
     * @return PredisProvider
     */
    public function createCacheProvider()
    {
        return new PredisProvider($this->predis);
    }
}
<commit_msg>enable predis<commit_after><?php

namespace Zie\DeviceDetector\Tests\CacheProvider;

use Zie\DeviceDetector\CacheProvider\PredisProvider;
use Zie\DeviceDetector\Tests\TestCase\CacheProviderTestCase;

/**
 * Class PredisProviderTest
 * @package Zie\DeviceDetector\Tests\CacheProvider
 */
class PredisProviderTest extends CacheProviderTestCase
{
    /**
     * @var \Predis\Redis
     */
    private $predis;

    /**
     * {@inheritdoc}
     */
    public function setUp()
    {
        if(!class_exists('Predis\Redis')) {
            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of predis/predis component.');
        }

        $this->predis = new \Predis\Redis();
        try {
            $this->predis->connect();
        } catch (\Predis\Connection\ConnectionException $e) {
            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis');
        }
    }

    public function tearDown()
    {
        if ($this->predis instanceof \Predis\Redis) {
            $this->predis->flushdb();
        }
    }

    /**
     * @return PredisProvider
     */
    public function createCacheProvider()
    {
        return new PredisProvider($this->predis);
    }
}

{'fraction_non_alphanumeric': 0.13047102959566487, 'fraction_numerical': 0.0, 'mean_word_length': 2.3472803347280333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '3435974', 'n_tokens_mistral': 723, 'n_tokens_neox': 720, 'n_words': 127}