<commit_before><?php
use Gzero\Api\UrlParamsProcessor;

/**
 * This file is part of the GZERO CMS package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * Class UrlParamsProcessorTest
 *
 * @author     <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2014, <NAME>
 */
class UrlParamsProcessorTest extends \PHPUnit_Framework_TestCase {

    /**
     * @var UrlParamsProcessor
     */
    protected $processor;

    protected function setUp()
    {
        $this->processor = $this->initClass();
    }

    /**
     * @test
     */
    public function is_instantiable()
    {
        $this->assertInstanceOf('\Gzero\Api\UrlParamsProcessor', $this->processor);
    }

    /**
     * @test
     */
    public function can_filter_params()
    {
        $this->assertEquals($this->processor->getFilterParams(), ['lang' => 'en', 'test2' => 'test2']);
    }

    /**
     * @test
     */
    public function is_returning_page_params()
    {
        $this->assertEquals($this->processor->getPage(), 3);
        $this->assertEquals($this->processor->getPerPage(), 21);
    }

    /**
     * @test
     */
    public function can_process_sort_params()
    {
        $this->assertEquals($this->processor->getOrderByParams(), ['test1' => 'DESC', 'test2' => 'ASC', 'test3' => 'ASC']);
    }

    /**
     * @test
     */
    public function is_returning_processed_fields_in_correct_format()
    {
        $this->assertEquals(
            $this->processor->getProcessedFields(),
            [
                'page'    => 3,
                'perPage' => 21,
                'filer'   => [
                    'lang'  => 'en',
                    'test2' => 'test2'
                ],
                'orderBy' => [
                    'test1' => 'DESC',
                    'test2' => 'ASC',
                    'test3' => 'ASC'
                ]
            ]
        );
    }

    /**
     * @return UrlParamsProcessor
     */
    protected function initClass()
    {
        return new UrlParamsProcessor(
            [
                'sort'    => '-test1,test2,test3',
                'page'    => 3,
                'perPage' => 21,
                'lang'    => 'en',
                'test2'   => 'test2'
            ]
        );
    }
}<commit_msg>Fixed test<commit_after><?php
use Gzero\Api\UrlParamsProcessor;

/**
 * This file is part of the GZERO CMS package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * Class UrlParamsProcessorTest
 *
 * @author     <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2014, <NAME>
 */
class UrlParamsProcessorTest extends \PHPUnit_Framework_TestCase {

    /**
     * @var UrlParamsProcessor
     */
    protected $processor;

    protected function setUp()
    {
        $this->processor = $this->initClass();
    }

    /**
     * @test
     */
    public function is_instantiable()
    {
        $this->assertInstanceOf('\Gzero\Api\UrlParamsProcessor', $this->processor);
    }

    /**
     * @test
     */
    public function can_filter_params()
    {
        $this->assertEquals($this->processor->getFilterParams(), ['lang' => 'en', 'test2' => 'test2']);
    }

    /**
     * @test
     */
    public function is_returning_page_params()
    {
        $this->assertEquals($this->processor->getPage(), 3);
        $this->assertEquals($this->processor->getPerPage(), 21);
    }

    /**
     * @test
     */
    public function can_process_sort_params()
    {
        $this->assertEquals($this->processor->getOrderByParams(), ['test1' => 'DESC', 'test2' => 'ASC', 'test3' => 'ASC']);
    }

    /**
     * @test
     */
    public function is_returning_processed_fields_in_correct_format()
    {
        $this->assertEquals(
            $this->processor->getProcessedFields(),
            [
                'page'    => 3,
                'perPage' => 21,
                'filter'   => [
                    'lang'  => 'en',
                    'test2' => 'test2'
                ],
                'orderBy' => [
                    'test1' => 'DESC',
                    'test2' => 'ASC',
                    'test3' => 'ASC'
                ]
            ]
        );
    }

    /**
     * @return UrlParamsProcessor
     */
    protected function initClass()
    {
        return (new UrlParamsProcessor())->process(
            [
                'sort'    => '-test1,test2,test3',
                'page'    => 3,
                'perPage' => 21,
                'lang'    => 'en',
                'test2'   => 'test2'
            ]
        );
    }
}
{'fraction_non_alphanumeric': 0.1506114567689337, 'fraction_numerical': 0.012014589143960523, 'mean_word_length': 1.608841634023503, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 88, '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': '1763572', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1341, 'n_words': 257}