Sha256: 60fae0dbd67d251dffa30b87c568743782e2e0afa178a73d33b4ab25abdfaae0

Contents?: true

Size: 1.98 KB

Versions: 208

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 "you_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

208 entries across 208 versions & 1 rubygems

Version Path
trackler-2.2.1.86 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.85 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.84 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.83 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.82 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.81 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.80 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.79 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.78 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.77 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.76 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.75 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.74 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.73 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.72 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.71 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.70 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.69 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.68 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.67 tracks/php/exercises/gigasecond/gigasecond_test.php