Sha256: cd26ebd94d4b6d936f2870a6511ceac13b0dd73fa98cb14e77bca49ae55a5eaf

Contents?: true

Size: 1.98 KB

Versions: 92

Compression:

Stored size: 1.98 KB

Contents

<?php

require "gigasecond.php";

class GigasecondTest extends PHPUnit\Framework\TestCase
{

    public function dateSetup($date)
    {
        $UTC = new DateTimeZone("UTC");
        $date = new DateTime($date, $UTC);
        return $date;
    }

    public function testDate1()
    {
        $date = GigasecondTest::dateSetup("2011-04-25");
        $gs = from($date);

        $this->assertSame("2043-01-01 01:46:40", $gs->format("Y-m-d H:i:s"));
    }

    public function testDate2()
    {
        $this->markTestSkipped();
        $date = GigasecondTest::dateSetup("1977-06-13");
        $gs = from($date);

        $this->assertSame("2009-02-19 01:46:40", $gs->format("Y-m-d H:i:s"));
    }

    public function testPreUnixEpoch()
    {
        $this->markTestSkipped();
        $date = GigasecondTest::dateSetup("1959-7-19");
        $gs = from($date);

        $this->assertSame("1991-03-27 01:46:40", $gs->format("Y-m-d H:i:s"));
    }

    public function testDateWithTime1()
    {
        $this->markTestSkipped();
        $date = GigasecondTest::dateSetup("2015-01-24 22:00:00");
        $gs = from($date);

        $this->assertSame("2046-10-02 23:46:40", $gs->format("Y-m-d H:i:s"));
    }

    public function testDateWithTime2()
    {
        $this->markTestSkipped();
        $date = GigasecondTest::dateSetup("2015-01-24 23:59:59");
        $gs = from($date);

        $this->assertSame("2046-10-03 01:46:39", $gs->format("Y-m-d H:i:s"));
    }

    public function testNoMutation()
    {
        $this->markTestSkipped();
        $date = GigasecondTest::dateSetup("2015-01-24");
        $gs = from($date);

        $this->assertNotEquals($date, $gs);
    }

    public function testYourself()
    {
        // Replace the string "your_birthday" with your birthday's datestring

        $this->markTestSkipped("Skip");
        $your_birthday = GigasecondTest::dateSetup("your_birthday");
        $gs = from($your_birthday);

        $this->assertSame("2046-10-03 01:46:39", $gs->format("Y-m-d H:i:s"));
    }
}

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.179 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.178 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.177 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.176 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.175 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.174 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.173 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.172 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.171 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.170 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.169 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.167 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.166 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.165 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.164 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.163 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.162 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.161 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.160 tracks/php/exercises/gigasecond/gigasecond_test.php