<commit_before><?php

class BulkQueryTest extends \Codeception\TestCase\Test
{

    use \Codeception\Specify;

    const BULK_SIZE = 5;

    /**
     * @var \UnitTester
     */
    protected $tester;

    /**
     * @var \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkQuery
     */
    private $query;


    /**
     * @inheritdoc
     */
    public function _before()
    {
        $this->query = new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkQuery(self::BULK_SIZE);
    }


    public function testActionHandling()
    {
        $this->specify('testing item handling', function () {
            verify($this->query->isReady())->false();

            for ($i = 0; $i < self::BULK_SIZE; $i++) {
                $this->query->addAction(new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction());
            }

            verify($this->query->hasItems())->true();
            verify($this->query->isReady())->true();

            $this->query->reset();
            verify($this->query->hasItems())->false();
        });

    }


    public function testSerialization()
    {
        $this->specify('checking serialization', function () {
            $index = [
                '_index' => 'foo',
                '_type'  => 'bar',
                '_id'    => 'baz',
            ];

            $body = [
                'foo' => 'bar',
            ];

            // Add two actions (same item twice)
            $action = new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction();
            $action->setAction(\Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction::ACTION_INDEX, $index)
                   ->setBody($body);

            $this->query->addAction($action)->addAction($action);

            verify($this->query->toArray())->equals([
                'body' => [
                    [
                        'index' => $index,
                        $body,
                    ],

                    [
                        'index' => $index,
                        $body,
                    ],

                ],
            ]);
        });
    }

}<commit_msg>Minor semantic changes to BulkQueryTest<commit_after><?php

class BulkQueryTest extends \Codeception\TestCase\Test
{

    use \Codeception\Specify;

    const BULK_SIZE = 5;

    /**
     * @var \UnitTester
     */
    protected $tester;

    /**
     * @var \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkQuery
     */
    private $query;


    /**
     * @inheritdoc
     */
    public function _before()
    {
        $this->query = new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkQuery(self::BULK_SIZE);
    }


    public function testActionHandling()
    {
        $this->specify('testing item handling', function () {
            verify($this->query->isReady())->false();

            for ($i = 0; $i < self::BULK_SIZE; $i++) {
                $this->query->addAction(new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction());
            }

            verify($this->query->hasItems())->true();
            verify($this->query->isReady())->true();

            $this->query->reset();
            verify($this->query->hasItems())->false();
        });

    }


    public function testSerialization()
    {
        $this->specify('checking serialization', function () {
            $actionName = \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction::ACTION_INDEX;

            $metadata = [
                '_index' => 'foo',
                '_type'  => 'bar',
                '_id'    => 'baz',
            ];

            $body = [
                'foo' => 'bar',
            ];

            // Add two actions (same item twice)
            $action = new \Nord\Lumen\Elasticsearch\Queries\Bulk\BulkAction();
            $action->setAction($actionName, $metadata)->setBody($body);

            $this->query->addAction($action)->addAction($action);

            verify($this->query->toArray())->equals([
                'body' => [
                    [
                        $actionName => $metadata,
                        $body,
                    ],

                    [
                        $actionName => $metadata,
                        $body,
                    ],

                ],
            ]);
        });
    }

}
{'fraction_non_alphanumeric': 0.15622032288698956, 'fraction_numerical': 0.000949667616334283, 'mean_word_length': 1.4088050314465408, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 71, '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': '3489864', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1176, 'n_words': 169}