author | ymh <ymh.work@gmail.com> |
Sat, 06 Aug 2016 21:29:33 +0700 | |
changeset 261 | 02e2396bcbbc |
parent 152 | dd6b3adde73b |
permissions | -rw-r--r-- |
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
use CorpusParole\Libraries\Utils; |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
class UtilsTest extends TestCase { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
function __construct(string $name = null) { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
parent::__construct($name); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
public function setup() { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
public function tearDown() { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
public function testDateIntervalToMillis() { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
$di = new \DateInterval("P1Y1M1DT1H1M1S"); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
$ms = Utils::dateIntervalToMillis($di); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
$this->assertEquals(34277461000, $ms, "duration must be 3427746100"); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
} |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
|
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
public function testiso8601IntervalToMillis() { |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
$ms = Utils::iso8601IntervalToMillis("P1Y1M1DT1H1M1S"); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
$this->assertEquals(34277461000, $ms, "duration must be 3427746100"); |
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
} |
20
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
28 |
|
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
29 |
public function testiso8601IntervalToMillisNull() { |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
30 |
$ms = Utils::iso8601IntervalToMillis(null); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
31 |
$this->assertNull($ms, "duration must be null"); |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
32 |
} |
a9b98b16b053
add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
33 |
|
261
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
34 |
public function testiso8601IntervalToMillisDoubleZero() { |
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
35 |
$ms = Utils::iso8601IntervalToMillis("PT47M00S"); |
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
36 |
$this->assertEquals(2820000, $ms, "duration must be 2820000"); |
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
37 |
} |
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
38 |
|
02e2396bcbbc
Migrate to ember 2.7 + correct jquery null context error + declare shim for popcorn (instead of silencing the JSHint error)
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
39 |
|
19
eadaf0b8f02e
Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
} |