<commit_before><?php

namespace Enqueue\Redis\Tests;

use Enqueue\Null\NullQueue;
use Enqueue\Null\NullTopic;
use Enqueue\Psr\InvalidDestinationException;
use Enqueue\Psr\PsrContext;
use Enqueue\Redis\Redis;
use Enqueue\Redis\RedisConsumer;
use Enqueue\Redis\RedisContext;
use Enqueue\Redis\RedisDestination;
use Enqueue\Redis\RedisMessage;
use Enqueue\Redis\RedisProducer;
use Enqueue\Test\ClassExtensionTrait;

class RedisContextTest extends \PHPUnit\Framework\TestCase
{
    use ClassExtensionTrait;

    public function testShouldImplementContextInterface()
    {
        $this->assertClassImplements(PsrContext::class, RedisContext::class);
    }

    public function testCouldBeConstructedWithRedisAsFirstArgument()
    {
        new RedisContext($this->createRedisMock());
    }

    public function testCouldBeConstructedWithRedisFactoryAsFirstArgument()
    {
        new RedisContext(function () {
            return $this->createRedisMock();
        });
    }

    public function testThrowIfNeitherRedisNorFactoryGiven()
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('The $redis argument must be either Enqueue\Redis\Redis or callable that returns $s once called.');
        new RedisContext(new \stdClass());
    }

    public function testShouldAllowCreateEmptyMessage()
    {
        $context = new RedisContext($this->createRedisMock());

        $message = $context->createMessage();

        $this->assertInstanceOf(RedisMessage::class, $message);
<commit_msg>fix tests.<commit_after><?php

namespace Enqueue\Redis\Tests;

use Enqueue\Null\NullQueue;
use Enqueue\Null\NullTopic;
use Enqueue\Psr\InvalidDestinationException;
use Enqueue\Psr\PsrContext;
use Enqueue\Redis\Redis;
use Enqueue\Redis\RedisConsumer;
use Enqueue\Redis\RedisContext;
use Enqueue\Redis\RedisDestination;
use Enqueue\Redis\RedisMessage;
use Enqueue\Redis\RedisProducer;
use Enqueue\Test\ClassExtensionTrait;

class RedisContextTest extends \PHPUnit\Framework\TestCase
{
    use ClassExtensionTrait;

    public function testShouldImplementContextInterface()
    {
        $this->assertClassImplements(PsrContext::class, RedisContext::class);
    }

    public function testCouldBeConstructedWithRedisAsFirstArgument()
    {
        new RedisContext($this->createRedisMock());
    }

    public function testCouldBeConstructedWithRedisFactoryAsFirstArgument()
    {
        new RedisContext(function () {
            return $this->createRedisMock();
        });
    }

    public function testThrowIfNeitherRedisNorFactoryGiven()
    {
        $this->expectException(\InvalidArgumentException::class);
        $this->expectExceptionMessage('The $redis argument must be either Enqueue\Redis\Redis or callable that returns Enqueue\Redis\Redis once called.');
        new RedisContext(new \stdClass());
    }

    public function testShouldAllowCreateEmptyMessage()
    {
        $context = new RedisContext($this->createRedisMock());

        $message = $context->createMessage();

        $this->assertInstanceOf(RedisMessage::class, $message);

{'fraction_non_alphanumeric': 0.09941897998708844, 'fraction_numerical': 0.0, 'mean_word_length': 4.190954773869347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '6702445', 'n_tokens_mistral': 902, 'n_tokens_neox': 889, 'n_words': 159}