<commit_before><?php

/*
 * This file is part of the IMTDataGrid package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace IMT\DataGrid\Tests\Filter;

use IMT\DataGrid\Filter\Rule;

/**
 * @author <NAME> <<EMAIL>>
 */
class RuleTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Rule
     */
    private $rule;

    /**
     * {@inheritDoc}
     */
    public function setUp()
    {
        parent::setUp();

        $this->rule = new Rule(
            array(
                'data'  => 'data',
                'field' => 'field',
                'op'    => 'bn',
            )
        );
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::__construct
     * @covers IMT\DataGrid\Filter\Rule::loadValidatorMetadata
     */
    public function testConstructedWithoutRequiredOptions()
    {
        $this->setExpectedException('IMT\DataGrid\Exception\InvalidOptionsException');

        new Rule(array());
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::__construct
     * @covers IMT\DataGrid\Filter\Rule::loadValidatorMetadata
     */
    public function testConstructedWithInvalidOptionOperator()
    {
        $this->setExpectedException('IMT\DataGrid\Exception\InvalidOptionsException');

        new Rule(array('field' => 'field', 'data' => 'data', 'op' => 'op'));
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::getData
     */
    public function testGetData()<commit_msg>The `testConstructedWithInvalidOptionOperator` test renamed to `testConstructedWithInvalidOperator`<commit_after><?php

/*
 * This file is part of the IMTDataGrid package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace IMT\DataGrid\Tests\Filter;

use IMT\DataGrid\Filter\Rule;

/**
 * @author <NAME> <<EMAIL>>
 */
class RuleTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Rule
     */
    private $rule;

    /**
     * {@inheritDoc}
     */
    public function setUp()
    {
        parent::setUp();

        $this->rule = new Rule(
            array(
                'data'  => 'data',
                'field' => 'field',
                'op'    => 'bn',
            )
        );
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::__construct
     * @covers IMT\DataGrid\Filter\Rule::loadValidatorMetadata
     */
    public function testConstructedWithoutRequiredOptions()
    {
        $this->setExpectedException('IMT\DataGrid\Exception\InvalidOptionsException');

        new Rule(array());
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::__construct
     * @covers IMT\DataGrid\Filter\Rule::loadValidatorMetadata
     */
    public function testConstructedWithInvalidOperator()
    {
        $this->setExpectedException('IMT\DataGrid\Exception\InvalidOptionsException');

        new Rule(array('field' => 'field', 'data' => 'data', 'op' => 'op'));
    }

    /**
     * @covers IMT\DataGrid\Filter\Rule::getData
     */
    public function testGetData()
{'fraction_non_alphanumeric': 0.1397712833545108, 'fraction_numerical': 0.0, 'mean_word_length': 2.4228260869565217, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 33, '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': '5207441', 'n_tokens_mistral': 946, 'n_tokens_neox': 929, 'n_words': 186}