<commit_before><?php

namespace Sabre\VObject\Recur;

use DateTimeImmutable;
use DateTimeZone;

class RDateIteratorTest extends \PHPUnit_Framework_TestCase {

    function testSimple() {

        $utc = new DateTimeZone('UTC');
        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));

        $expected = [
            new DateTimeImmutable('2014-08-01 00:00:00', $utc),
            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
        ];

        $this->assertEquals(
            $expected,
            iterator_to_array($it)
        );

        $this->assertFalse($it->isInfinite());

    }

    function testFastForward() {

        $utc = new DateTimeZone('UTC');
        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));

        $it->fastForward(new DateTimeImmutable('2014-08-15 00:00:00'));

        $result = [];
        while ($it->valid()) {
            $result[] = $it->current();
            $it->next();
        }

        $expected = [
            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
        ];

        $this->assertEquals(
            $expected,
            $result
        );

        $this->assertFalse($it->isInfinite());

    }
}
<commit_msg>add test for RDateIterator and timezones<commit_after><?php

namespace Sabre\VObject\Recur;

use DateTimeImmutable;
use DateTimeZone;

class RDateIteratorTest extends \PHPUnit_Framework_TestCase {

    function testSimple() {

        $utc = new DateTimeZone('UTC');
        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));

        $expected = [
            new DateTimeImmutable('2014-08-01 00:00:00', $utc),
            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
        ];

        $this->assertEquals(
            $expected,
            iterator_to_array($it)
        );

        $this->assertFalse($it->isInfinite());

    }

    function testTimezone() {

        $tz = new DateTimeZone('Europe/Berlin');
        $it = new RDateIterator('20140901T000000,20141001T000000', new DateTimeImmutable('2014-08-01 00:00:00', $tz));

        $expected = [
            new DateTimeImmutable('2014-08-01 00:00:00', $tz),
            new DateTimeImmutable('2014-09-01 00:00:00', $tz),
            new DateTimeImmutable('2014-10-01 00:00:00', $tz),
        ];

        $result = iterator_to_array($it);

        $this->assertEquals(
            $expected,
            iterator_to_array($it)
        );


        $this->assertFalse($it->isInfinite());

    }


    function testFastForward() {

        $utc = new DateTimeZone('UTC');
        $it = new RDateIterator('20140901T000000Z,20141001T000000Z', new DateTimeImmutable('2014-08-01 00:00:00', $utc));

        $it->fastForward(new DateTimeImmutable('2014-08-15 00:00:00'));

        $result = [];
        while ($it->valid()) {
            $result[] = $it->current();
            $it->next();
        }

        $expected = [
            new DateTimeImmutable('2014-09-01 00:00:00', $utc),
            new DateTimeImmutable('2014-10-01 00:00:00', $utc),
        ];

        $this->assertEquals(
            $expected,
            $result
        );

        $this->assertFalse($it->isInfinite());

    }
}

{'fraction_non_alphanumeric': 0.15408538309301667, 'fraction_numerical': 0.11874469889737066, 'mean_word_length': 2.3096351730589335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '5313246', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1086, 'n_words': 184}