server/src/tests/libraries/UtilsTest.php
changeset 19 eadaf0b8f02e
child 20 a9b98b16b053
equal deleted inserted replaced
18:f2a40bbc27f6 19:eadaf0b8f02e
       
     1 <?php
       
     2 
       
     3 use CorpusParole\Libraries\Utils;
       
     4 
       
     5 class UtilsTest extends TestCase {
       
     6     function __construct(string $name = null) {
       
     7         parent::__construct($name);
       
     8     }
       
     9 
       
    10     public function setup() {
       
    11     }
       
    12 
       
    13     public function tearDown() {
       
    14     }
       
    15 
       
    16     public function testDateIntervalToMillis() {
       
    17         $di = new \DateInterval("P1Y1M1DT1H1M1S");
       
    18 
       
    19         $ms = Utils::dateIntervalToMillis($di);
       
    20 
       
    21         $this->assertEquals(34277461000, $ms, "duration must be 3427746100");
       
    22     }
       
    23 
       
    24     public function testiso8601IntervalToMillis() {
       
    25         $ms = Utils::iso8601IntervalToMillis("P1Y1M1DT1H1M1S");
       
    26         $this->assertEquals(34277461000, $ms, "duration must be 3427746100");
       
    27     }
       
    28 }