<commit_before><?php

namespace Oro\Bundle\FilterBundle\Tests\Unit\Filter;

use Oro\Bundle\FilterBundle\Filter\DateFilterUtility;
use Oro\Bundle\FilterBundle\Form\Type\Filter\DateRangeFilterType;
use Oro\Bundle\FilterBundle\Provider\DateModifierInterface;

class DateFilterUtilityTest extends \PHPUnit_Framework_TestCase
{
    /** @var DateFilterUtility */
    protected $utility;

    protected function setUp()
    {
        $localeSettings = $this->getMockBuilder('Oro\Bundle\LocaleBundle\Model\LocaleSettings')
            ->disableOriginalConstructor()
            ->setMethods(array('getTimezone'))
            ->getMock();
        $localeSettings->expects($this->any())
            ->method('getTimezone')
            ->will($this->returnValue('Europe/Moscow'));

        $this->utility = new DateFilterUtility($localeSettings);
    }

    protected function tearDown()
    {
        unset($this->utility);
    }

    /**
     * @dataProvider parseDataProvider
     *
     * @param mixed  $data
     * @param string $fieldName
     * @param mixed  $expectedResults
     */
    public function testParse($data, $fieldName, $expectedResults)
    {
        $this->assertEquals($expectedResults, $this->utility->parseData($fieldName, $data));
    }

    /**
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     * @return array<commit_msg>BAP-5887: Broken Unit tests and filed build<commit_after><?php

namespace Oro\Bundle\FilterBundle\Tests\Unit\Filter;

use Oro\Bundle\FilterBundle\Filter\DateFilterUtility;
use Oro\Bundle\FilterBundle\Form\Type\Filter\DateRangeFilterType;
use Oro\Bundle\FilterBundle\Provider\DateModifierInterface;

class DateFilterUtilityTest extends \PHPUnit_Framework_TestCase
{
    /** @var DateFilterUtility */
    protected $utility;

    protected function setUp()
    {
        $localeSettings = $this->getMockBuilder('Oro\Bundle\LocaleBundle\Model\LocaleSettings')
            ->disableOriginalConstructor()
            ->setMethods(array('getTimezone'))
            ->getMock();
        $localeSettings->expects($this->any())
            ->method('getTimezone')
            ->will($this->returnValue('Asia/Tbilisi'));

        $this->utility = new DateFilterUtility($localeSettings);
    }

    protected function tearDown()
    {
        unset($this->utility);
    }

    /**
     * @dataProvider parseDataProvider
     *
     * @param mixed  $data
     * @param string $fieldName
     * @param mixed  $expectedResults
     */
    public function testParse($data, $fieldName, $expectedResults)
    {
        $this->assertEquals($expectedResults, $this->utility->parseData($fieldName, $data));
    }

    /**
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     * @return array
{'fraction_non_alphanumeric': 0.1278002203452075, 'fraction_numerical': 0.0014689680499449136, 'mean_word_length': 3.152439024390244, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '4046165', 'n_tokens_mistral': 770, 'n_tokens_neox': 771, 'n_words': 119}