<commit_before><?php

namespace Oro\Bundle\CalendarBundle\Tests\Functional\API;

use Oro\Bundle\CalendarBundle\Model\Recurrence;

/**
 * @dbIsolation
 * @dbReindex
 */
class RestCalendarRecurrentEventUpdateExceptionTest extends AbstractUseCaseTestCase
{
    /**
     * @dataProvider updateExceptionsTestData
     *
     * @param $changedEventData
     * @param $expectedCalendarEvents
     */
    public function testUpdateExceptionsCases($changedEventData, $expectedCalendarEvents)
    {
        $calendarEventId = $this->createRecurringEventWithExceptions();
        $eventData = $this->getCalendarEventData();
        $eventData = array_replace_recursive($eventData, $changedEventData);

        $this->updateCalendarEventViaAPI($calendarEventId, $eventData);

        $actualEvents = $this->getOrderedCalendarEventsViaAPI($this->getApiRequestData());
        $this->assertCalendarEvents($expectedCalendarEvents, $actualEvents);
        $this->deleteEventViaAPI($calendarEventId);
    }

    /**
     * @return int
     */<commit_msg>CRM-6749: Functional tests for logic of resetting exceptions of recurring events - fixed working with other Functional tests<commit_after><?php

namespace Oro\Bundle\CalendarBundle\Tests\Functional\API;

use Oro\Bundle\CalendarBundle\Model\Recurrence;
use Oro\Component\PhpUtils\ArrayUtil;

/**
 * @dbIsolation
 */
class RestCalendarRecurrentEventUpdateExceptionTest extends AbstractUseCaseTestCase
{
    /**
     * @dataProvider updateExceptionsTestData
     *
     * @param $changedEventData
     * @param $expectedCalendarEvents
     */
    public function testUpdateExceptionsCases($changedEventData, $expectedCalendarEvents)
    {
        $result = $this->getOrderedCalendarEventsViaAPI($this->getApiRequestData());
        if (!empty($result)) {
            $ids = ArrayUtil::arrayColumn($result, 'id');
            $ids = array_unique($ids);
            foreach ($ids as $id) {
                $this->deleteEventViaAPI($id);
            }
        }

        $calendarEventId = $this->createRecurringEventWithExceptions();
        $eventData = $this->getCalendarEventData();
        $eventData = array_replace_recursive($eventData, $changedEventData);

        $this->updateCalendarEventViaAPI($calendarEventId, $eventData);

        $actualEvents = $this->getOrderedCalendarEventsViaAPI($this->getApiRequestData());
        $this->assertCalendarEvents($expectedCalendarEvents, $actualEvents);
        $this->deleteEventViaAPI($calendarEventId);
    }

    /**
     * @return int
     */
{'fraction_non_alphanumeric': 0.11383399209486166, 'fraction_numerical': 0.0015810276679841897, 'mean_word_length': 3.766478342749529, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '3836253', 'n_tokens_mistral': 708, 'n_tokens_neox': 692, 'n_words': 105}