<commit_before><?php

require_once("class.m2datetime.inc.php");

/**
 * This tests Lunr's M2DateTime class
 * @covers M2DateTime
 */
class M2DateTimeTest extends PHPUnit_Framework_TestCase
{

    /**
     * Test the static function today()
     * @covers M2DateTime::today
     */
    public function testToday()
    {
        $this->assertEquals(M2DateTime::today(), date("Y-m-d"));
    }

    /**
     * Test the static function yesterday()
     * @covers M2DateTime::yesterday
     */
    public function testYesterday()
    {
        $this->assertEquals(M2DateTime::yesterday(), date("Y-m-d", strtotime("-1 day")));
    }

    /**
     * Test the static function tomorrow()
     * @covers M2DateTime::tomorrow
     */
    public function testTomorrow()
    {
        $this->assertEquals(M2DateTime::tomorrow(), date("Y-m-d", strtotime("+1 day")));
    }

    /**
     * Test the static function delayed_date()
     * @depends testTomorrow
     * @depends testYesterday
     * @covers M2DateTime::delayed_date
     */
    public function testDelayedDate()
    {
        $this->assertEquals(M2DateTime::delayed_date("-1 day"), M2DateTime::yesterday());
        $this->assertEquals(M2DateTime::delayed_date("+1 day"), M2DateTime::tomorrow());
    }

    /**
     * Test the static function delayed_timestamp()
     * @covers M2DateTime::delayed_timestamp
     */
    public function testDelayedTimestamp()
    {
        $this->assertEquals(M2DateTime::delayed_timestamp("+1 day"), strtotime("+1 day"));
    }

    /**
     * Test the static function now()
     * @covers M2DateTime::now
     */
    public function testNow()
    {
        $this->assertEquals(M2DateTime::now(), strftime("%H:%M:%S", time()));
    }

    /**
     * Test the static function get_date()
     * @depends testDelayedTimestamp
     * @dataProvider timestampProvider
     * @covers M2DateTime::get_date
     */
    public function testGetDate($timestamp)
    {
        $this->assertEquals(M2DateTime::get_date($timestamp), date("Y-m-d", $timestamp));
    }

    /**
     * Test the static function get_time()
     * @depends testDelayedTimestamp
     * @dataProvider timestampProvider
     * @covers M2DateTime::get_time
     */
    public function testGetTime($timestamp)
    {
        $this->assertEquals(M2DateTime::get_time($timestamp), strftime("%H:%M:%S", $timestamp));
    }

    /**<commit_msg>tests: Implement unit test for get_delayed_datetime<commit_after><?php

require_once("class.m2datetime.inc.php");

/**
 * This tests Lunr's M2DateTime class
 * @covers M2DateTime
 */
class M2DateTimeTest extends PHPUnit_Framework_TestCase
{

    /**
     * Test the static function today()
     * @covers M2DateTime::today
     */
    public function testToday()
    {
        $this->assertEquals(M2DateTime::today(), date("Y-m-d"));
    }

    /**
     * Test the static function yesterday()
     * @covers M2DateTime::yesterday
     */
    public function testYesterday()
    {
        $this->assertEquals(M2DateTime::yesterday(), date("Y-m-d", strtotime("-1 day")));
    }

    /**
     * Test the static function tomorrow()
     * @covers M2DateTime::tomorrow
     */
    public function testTomorrow()
    {
        $this->assertEquals(M2DateTime::tomorrow(), date("Y-m-d", strtotime("+1 day")));
    }

    /**
     * Test the static function delayed_date()
     * @depends testTomorrow
     * @depends testYesterday
     * @covers M2DateTime::delayed_date
     */
    public function testDelayedDate()
    {
        $this->assertEquals(M2DateTime::delayed_date("-1 day"), M2DateTime::yesterday());
        $this->assertEquals(M2DateTime::delayed_date("+1 day"), M2DateTime::tomorrow());
    }

    /**
     * Test the static function delayed_timestamp()
     * @covers M2DateTime::delayed_timestamp
     */
    public function testDelayedTimestamp()
    {
        $this->assertEquals(M2DateTime::delayed_timestamp("+1 day"), strtotime("+1 day"));
    }

    /**
     * Test the static function delayed_datetime()
     * @depends testDelayedTimestamp
     * @covers M2DateTime::delayed_datetime
     */
    public function testDelayedDatetime()
    {
        $timestamp = M2DateTime::delayed_timestamp("+1 day");
        $this->assertEquals(M2DateTime::delayed_datetime("+1 day"), date('Y-m-d H:i:s', strtotime("+1 day", time())));
        $this->assertEquals(M2DateTime::delayed_datetime("+1 day", $timestamp), date('Y-m-d H:i:s', strtotime("+2 days")));
    }

    /**
     * Test the static function now()
     * @covers M2DateTime::now
     */
    public function testNow()
    {
        $this->assertEquals(M2DateTime::now(), strftime("%H:%M:%S", time()));
    }

    /**
     * Test the static function get_date()
     * @depends testDelayedTimestamp
     * @dataProvider timestampProvider
     * @covers M2DateTime::get_date
     */
    public function testGetDate($timestamp)
    {
        $this->assertEquals(M2DateTime::get_date($timestamp), date("Y-m-d", $timestamp));
    }

    /**
     * Test the static function get_time()
     * @depends testDelayedTimestamp
     * @dataProvider timestampProvider
     * @covers M2DateTime::get_time
     */
    public function testGetTime($timestamp)
    {
        $this->assertEquals(M2DateTime::get_time($timestamp), strftime("%H:%M:%S", $timestamp));
    }

    /**
{'fraction_non_alphanumeric': 0.14969834087481146, 'fraction_numerical': 0.012631975867269985, 'mean_word_length': 3.0311550151975686, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '975554', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1602, 'n_words': 302}