<commit_before><?php

namespace Cron\Tests;

use Cron\HoursField;
use DateTime;

/**
 * @author <NAME> <<EMAIL>>
 */
class HoursFieldTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers Cron\HoursField::validate
     */
    public function testValdatesField()
    {
        $f = new HoursField();
        $this->assertTrue($f->validate('1'));
        $this->assertTrue($f->validate('*'));
        $this->assertTrue($f->validate('*/3,1,1-12'));
     }

    /**
     * @covers Cron\HoursField::increment
     */
    public function testIncrementsDate()
    {
        $d = new DateTime('2011-03-15 11:15:00');
        $f = new HoursField();
        $f->increment($d);
        $this->assertEquals('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s'));

        $d->setTime(11, 15, 0);
        $f->increment($d, true);
        $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s'));
    }
}<commit_msg>Added additional unit test to verify the HoursField parser when a time zone with non-hour offset is used<commit_after><?php

namespace Cron\Tests;

use Cron\HoursField;
use DateTime;

/**
 * @author <NAME> <<EMAIL>>
 */
class HoursFieldTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @covers Cron\HoursField::validate
     */
    public function testValdatesField()
    {
        $f = new HoursField();
        $this->assertTrue($f->validate('1'));
        $this->assertTrue($f->validate('*'));
        $this->assertTrue($f->validate('*/3,1,1-12'));
     }

    /**
     * @covers Cron\HoursField::increment
     */
    public function testIncrementsDate()
    {
        $d = new DateTime('2011-03-15 11:15:00');
        $f = new HoursField();
        $f->increment($d);
        $this->assertEquals('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s'));

        $d->setTime(11, 15, 0);
        $f->increment($d, true);
        $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s'));
    }
	
    /**
     * @covers Cron\HoursField::increment
     */
    public function testIncrementsDateWithThirtyMinuteOffsetTimezone()
    {
		$tz = date_default_timezone_get();
		date_default_timezone_set('America/St_Johns');
        $d = new DateTime('2011-03-15 11:15:00');		
        $f = new HoursField();
        $f->increment($d);
        $this->assertEquals('2011-03-15 12:00:00', $d->format('Y-m-d H:i:s'));

        $d->setTime(11, 15, 0);
        $f->increment($d, true);
        $this->assertEquals('2011-03-15 10:59:00', $d->format('Y-m-d H:i:s'));
		date_default_timezone_set($tz);
    }
	
}
{'fraction_non_alphanumeric': 0.1970774091627172, 'fraction_numerical': 0.06042654028436019, 'mean_word_length': 2.741506646971935, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 42, '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': '1529523', 'n_tokens_mistral': 1006, 'n_tokens_neox': 885, 'n_words': 149}