server/src/tests/Libraries/UtilsTest.php
author ymh <ymh.work@gmail.com>
Tue, 07 Jun 2016 01:16:31 +0200
changeset 173 cf7b221238fd
parent 152 dd6b3adde73b
child 261 02e2396bcbbc
permissions -rw-r--r--
Work on test fixtures: - get rid both on bo and front of 2 fixtures files for documents - correct dl_fixtures to reflect this - upgrade mirage from 0.1.13 to 0.2.0 - download new version of documents fixtures including geo information

<?php

use CorpusParole\Libraries\Utils;

class UtilsTest extends TestCase {
    function __construct(string $name = null) {
        parent::__construct($name);
    }

    public function setup() {
    }

    public function tearDown() {
    }

    public function testDateIntervalToMillis() {
        $di = new \DateInterval("P1Y1M1DT1H1M1S");

        $ms = Utils::dateIntervalToMillis($di);

        $this->assertEquals(34277461000, $ms, "duration must be 3427746100");
    }

    public function testiso8601IntervalToMillis() {
        $ms = Utils::iso8601IntervalToMillis("P1Y1M1DT1H1M1S");
        $this->assertEquals(34277461000, $ms, "duration must be 3427746100");
    }

    public function testiso8601IntervalToMillisNull() {
        $ms = Utils::iso8601IntervalToMillis(null);
        $this->assertNull($ms, "duration must be null");
    }

}