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.66 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.65 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.64 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.63 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.62 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.61 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.60 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.59 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.58 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.57 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.56 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.55 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.54 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.53 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.52 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.51 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.50 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.49 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.48 tracks/php/exercises/gigasecond/gigasecond_test.php
trackler-2.2.1.47 tracks/php/exercises/gigasecond/gigasecond_test.php