<commit_before><?php
namespace Imbo\BehatApiExtension\Context\Initializer;

use Imbo\BehatApiExtension\Context\ArrayContainsComparatorAwareContext;
use Imbo\BehatApiExtension\ArrayContainsComparator;
use Imbo\BehatApiExtension\ArrayContainsComparator\Matcher;
use PHPUnit_Framework_TestCase;

/**
 * @coversDefaultClass Imbo\BehatApiExtension\Context\Initializer\ArrayContainsComparatorAwareInitializer
 */
class ArrayContainsComparatorAwareInitializerTest extends PHPUnit_Framework_TestCase {
    /**
     * @covers ::__construct
     */
    public function testInitializerInjectsDefaultMatcherFunctions() {
        $comparator = $this->createMock(ArrayContainsComparator::class);
        $comparator
            ->expects($this->exactly(8))
            ->method('addFunction')
            ->withConsecutive(
                ['arrayLength', $this->isInstanceOf(Matcher\ArrayLength::class)],
                ['arrayMinLength', $this->isInstanceOf(Matcher\ArrayMinLength::class)],
                ['arrayMaxLength', $this->isInstanceOf(Matcher\ArrayMaxLength::class)],
                ['variableType', $this->isInstanceOf(Matcher\VariableType::class)],
                ['regExp', $this->isInstanceOf(Matcher\RegExp::class)],
                ['gt', $this->isInstanceOf(Matcher\GreaterThan::class)],
                ['lt', $this->isInstanceOf(Matcher\LessThan::class)],
                ['jwt', $this->isInstanceOf(Matcher\JWT::class)]
            )
            ->will($this->returnSelf());

        $initializer = new ArrayContainsComparatorAwareInitializer($comparator);
    }

    /**
     * @covers ::initializeContext
     */
    public function testInjectsComparatorWhenInitializingContext() {
        $comparator = $this->createMock(ArrayContainsComparator::class);
        $comparator
            ->expects($this->exactly(8))
            ->method('addFunction')
            ->will($this->returnSelf());

        $context = $this->createMock(ArrayContainsComparatorAwareContext::class);
        $context->expects($this->once())->method('setArrayContainsComparator')->with($comparator);

        $initializer = new ArrayContainsComparatorAwareInitializer($comparator);
        $initializer->initializeContext($context);
    }
}<commit_msg>Update test case<commit_after><?php declare(strict_types=1);
namespace Imbo\BehatApiExtension\Context\Initializer;

use Imbo\BehatApiExtension\Context\ArrayContainsComparatorAwareContext;
use Imbo\BehatApiExtension\ArrayContainsComparator;
use Imbo\BehatApiExtension\ArrayContainsComparator\Matcher;
use PHPUnit\Framework\TestCase;

/**
 * @coversDefaultClass Imbo\BehatApiExtension\Context\Initializer\ArrayContainsComparatorAwareInitializer
 */
class ArrayContainsComparatorAwareInitializerTest extends TestCase {
    /**
     * @covers ::__construct
     */
    public function testInitializerInjectsDefaultMatcherFunctions() : void {
        $comparator = $this->createMock(ArrayContainsComparator::class);
        $comparator
            ->expects($this->exactly(8))
            ->method('addFunction')
            ->withConsecutive(
                ['arrayLength', $this->isInstanceOf(Matcher\ArrayLength::class)],
                ['arrayMinLength', $this->isInstanceOf(Matcher\ArrayMinLength::class)],
                ['arrayMaxLength', $this->isInstanceOf(Matcher\ArrayMaxLength::class)],
                ['variableType', $this->isInstanceOf(Matcher\VariableType::class)],
                ['regExp', $this->isInstanceOf(Matcher\RegExp::class)],
                ['gt', $this->isInstanceOf(Matcher\GreaterThan::class)],
                ['lt', $this->isInstanceOf(Matcher\LessThan::class)],
                ['jwt', $this->isInstanceOf(Matcher\JWT::class)]
            )
            ->will($this->returnSelf());

        new ArrayContainsComparatorAwareInitializer($comparator);
    }

    /**
     * @covers ::initializeContext
     */
    public function testInjectsComparatorWhenInitializingContext() : void {
        $comparator = $this->createMock(ArrayContainsComparator::class);
        $comparator
            ->expects($this->exactly(8))
            ->method('addFunction')
            ->will($this->returnSelf());

        $context = $this->createMock(ArrayContainsComparatorAwareContext::class);
        $context->expects($this->once())->method('setArrayContainsComparator')->with($comparator);

        (new ArrayContainsComparatorAwareInitializer($comparator))->initializeContext($context);
    }
}
{'fraction_non_alphanumeric': 0.13464991023339318, 'fraction_numerical': 0.0011220825852782765, 'mean_word_length': 3.5619242579324464, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '2894802', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1197, 'n_words': 134}