DateTest.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. <?php
  2. /**
  3. * Tests Date class
  4. *
  5. * @group ko7
  6. * @group ko7.core
  7. * @group ko7.core.date
  8. *
  9. * @package KO7
  10. * @category Tests
  11. *
  12. * @author BRMatt <matthew@sigswitch.com>
  13. * @copyright (c) 2007-2016 Kohana Team
  14. * @copyright (c) since 2016 Koseven Team
  15. * @license https://koseven.dev/LICENSE
  16. */
  17. class KO7_DateTest extends Unittest_TestCase
  18. {
  19. protected $_original_timezone = NULL;
  20. protected $default_locale;
  21. /**
  22. * Ensures we have a consistant timezone for testing.
  23. */
  24. // @codingStandardsIgnoreStart
  25. public function setUp(): void
  26. // @codingStandardsIgnoreEnd
  27. {
  28. parent::setUp();
  29. $this->_original_timezone = date_default_timezone_get();
  30. $this->default_locale = setlocale(LC_ALL, 0);
  31. date_default_timezone_set('America/Chicago');
  32. setlocale(LC_ALL, 'en_US.utf8');
  33. }
  34. /**
  35. * Restores original timezone after testing.
  36. */
  37. // @codingStandardsIgnoreStart
  38. public function tearDown(): void
  39. // @codingStandardsIgnoreEnd
  40. {
  41. date_default_timezone_set($this->_original_timezone);
  42. setlocale(LC_ALL, $this->default_locale);
  43. parent::tearDown();
  44. }
  45. /**
  46. * Provides test data for test_offset()
  47. *
  48. * @return array
  49. */
  50. public function provider_offset()
  51. {
  52. return [
  53. [30600, 'Asia/Calcutta', 'America/Argentina/Buenos_Aires'],
  54. ];
  55. }
  56. /**
  57. * Tests Date::offset()
  58. *
  59. * @test
  60. * @dataProvider provider_offset
  61. * @covers Date::offset
  62. * @param integer $expected Expected offset
  63. * @param string $remote Remote TZ
  64. * @param string $local Local TZ
  65. * @param integer $now Current timestamp
  66. */
  67. public function test_offset($expected, $remote, $local, $now = NULL)
  68. {
  69. $this->assertSame($expected, Date::offset($remote, $local, $now));
  70. }
  71. /**
  72. * Provides test data for test_date()
  73. *
  74. * @return array
  75. */
  76. public function provider_am_pm()
  77. {
  78. return [
  79. // All possible values
  80. [0, 'AM'],
  81. [1, 'AM'],
  82. [2, 'AM'],
  83. [3, 'AM'],
  84. [4, 'AM'],
  85. [5, 'AM'],
  86. [6, 'AM'],
  87. [7, 'AM'],
  88. [8, 'AM'],
  89. [9, 'AM'],
  90. [10, 'AM'],
  91. [11, 'AM'],
  92. [12, 'PM'],
  93. [13, 'PM'],
  94. [14, 'PM'],
  95. [15, 'PM'],
  96. [16, 'PM'],
  97. [17, 'PM'],
  98. [18, 'PM'],
  99. [19, 'PM'],
  100. [20, 'PM'],
  101. [21, 'PM'],
  102. [22, 'PM'],
  103. [23, 'PM'],
  104. [24, 'PM'],
  105. // ampm doesn't validate the hour, so I don't think we should test it..
  106. // test strings are converted
  107. ['0', 'AM'],
  108. ['12', 'PM'],
  109. ];
  110. }
  111. /**
  112. * Tests Date::ampm()
  113. *
  114. * @test
  115. * @covers Date::ampm
  116. * @dataProvider provider_am_pm
  117. * @param <type> $hour
  118. * @param <type> $expected
  119. */
  120. public function test_am_pm($hour, $expected)
  121. {
  122. $this->assertSame(
  123. $expected,
  124. Date::ampm($hour)
  125. );
  126. }
  127. /**
  128. * Provides test data for test_adjust()
  129. *
  130. * @return array
  131. */
  132. public function provider_adjust()
  133. {
  134. return [
  135. // Might as well test all possibilities
  136. [1, 'am', '01'],
  137. [2, 'am', '02'],
  138. [3, 'am', '03'],
  139. [4, 'am', '04'],
  140. [5, 'am', '05'],
  141. [6, 'am', '06'],
  142. [7, 'am', '07'],
  143. [8, 'am', '08'],
  144. [9, 'am', '09'],
  145. [10, 'am', '10'],
  146. [11, 'am', '11'],
  147. [12, 'am', '00'],
  148. [1, 'pm', '13'],
  149. [2, 'pm', '14'],
  150. [3, 'pm', '15'],
  151. [4, 'pm', '16'],
  152. [5, 'pm', '17'],
  153. [6, 'pm', '18'],
  154. [7, 'pm', '19'],
  155. [8, 'pm', '20'],
  156. [9, 'pm', '21'],
  157. [10, 'pm', '22'],
  158. [11, 'pm', '23'],
  159. [12, 'pm', '12'],
  160. // It should also work with strings instead of ints
  161. ['10', 'pm', '22'],
  162. ['10', 'am', '10'],
  163. ];
  164. }
  165. /**
  166. * Tests Date::ampm()
  167. *
  168. * @test
  169. * @dataProvider provider_adjust
  170. * @param integer $hour Hour in 12 hour format
  171. * @param string $ampm Either am or pm
  172. * @param string $expected Expected result
  173. */
  174. public function test_adjust($hour, $ampm, $expected)
  175. {
  176. $this->assertSame(
  177. $expected,
  178. Date::adjust($hour, $ampm)
  179. );
  180. }
  181. /**
  182. * Provides test data for test_days()
  183. *
  184. * @return array
  185. */
  186. public function provider_days()
  187. {
  188. return [
  189. // According to "the rhyme" these should be the same every year
  190. [9, FALSE, 30],
  191. [4, FALSE, 30],
  192. [6, FALSE, 30],
  193. [11, FALSE, 30],
  194. [1, FALSE, 31],
  195. [3, FALSE, 31],
  196. [5, FALSE, 31],
  197. [7, FALSE, 31],
  198. [8, FALSE, 31],
  199. [10, FALSE, 31],
  200. // February is such a pain
  201. [2, 2001, 28],
  202. [2, 2000, 29],
  203. [2, 2012, 29],
  204. ];
  205. }
  206. /**
  207. * Tests Date::days()
  208. *
  209. * @test
  210. * @covers Date::days
  211. * @dataProvider provider_days
  212. * @param integer $month
  213. * @param integer $year
  214. * @param integer $expected
  215. */
  216. public function test_days($month, $year, $expected)
  217. {
  218. $days = Date::days($month, $year);
  219. $this->assertSame(
  220. $expected,
  221. count($days)
  222. );
  223. // This should be a mirrored array, days => days
  224. for ($i = 1; $i <= $expected; ++$i)
  225. {
  226. $this->assertArrayHasKey($i, $days);
  227. // Combining the type check into this saves about 400-500 assertions!
  228. $this->assertSame( (string) $i, $days[$i]);
  229. }
  230. }
  231. /**
  232. * Provides test data for test_formatted_time()
  233. *
  234. * @return array
  235. */
  236. public function provider_formatted_time()
  237. {
  238. return [
  239. // Test the default format
  240. ['2010-04-16 17:00:00', '5:00PM 16th April 2010'],
  241. // Now we use our own format
  242. // Binary date!
  243. ['01/01/2010 01:00', '1AM 1st January 2010', 'd/m/Y H:i'],
  244. // Timezones (see #3902)
  245. ['2011-04-01 01:23:45 Antarctica/South_Pole', '2011-04-01 01:23:45', 'Y-m-d H:i:s e', 'Antarctica/South_Pole'],
  246. ['2011-04-01 01:23:45 Antarctica/South_Pole', '2011-03-31 14:23:45 Europe/Paris', 'Y-m-d H:i:s e', 'Antarctica/South_Pole'],
  247. ['2011-04-01 01:23:45 Antarctica/South_Pole', '@1301574225', 'Y-m-d H:i:s e', 'Antarctica/South_Pole'],
  248. ];
  249. }
  250. /**
  251. * Tests Date::formatted_time()
  252. *
  253. * @test
  254. * @dataProvider provider_formatted_time
  255. * @covers Date::formatted_time
  256. * @ticket 3035 3902
  257. * @param string $expected Expected output
  258. * @param string|integer $datetime_str The datetime timestamp / string
  259. * @param string|null $timestamp_format The output format
  260. * @param string|null $timezone The timezone identifier
  261. */
  262. public function test_formatted_time($expected, $datetime_str, $timestamp_format = NULL, $timezone = NULL)
  263. {
  264. $timestamp = Date::formatted_time($datetime_str, $timestamp_format, $timezone);
  265. $this->assertSame($expected, $timestamp);
  266. }
  267. /**
  268. * Provider for test_months()
  269. *
  270. * @return array Test data
  271. */
  272. public function provider_months()
  273. {
  274. return [
  275. [
  276. [
  277. 1 => "1",
  278. 2 => "2",
  279. 3 => "3",
  280. 4 => "4",
  281. 5 => "5",
  282. 6 => "6",
  283. 7 => "7",
  284. 8 => "8",
  285. 9 => "9",
  286. 10 => "10",
  287. 11 => "11",
  288. 12 => "12"
  289. ],
  290. NULL
  291. ],
  292. [
  293. [
  294. 1 => "1",
  295. 2 => "2",
  296. 3 => "3",
  297. 4 => "4",
  298. 5 => "5",
  299. 6 => "6",
  300. 7 => "7",
  301. 8 => "8",
  302. 9 => "9",
  303. 10 => "10",
  304. 11 => "11",
  305. 12 => "12"
  306. ],
  307. 'Guinness'
  308. ],
  309. [
  310. [
  311. 1 => "January",
  312. 2 => "February",
  313. 3 => "March",
  314. 4 => "April",
  315. 5 => "May",
  316. 6 => "June",
  317. 7 => "July",
  318. 8 => "August",
  319. 9 => "September",
  320. 10 => "October",
  321. 11 => "November",
  322. 12 => "December"
  323. ],
  324. Date::MONTHS_LONG
  325. ],
  326. [
  327. [
  328. 1 => "Jan",
  329. 2 => "Feb",
  330. 3 => "Mar",
  331. 4 => "Apr",
  332. 5 => "May",
  333. 6 => "Jun",
  334. 7 => "Jul",
  335. 8 => "Aug",
  336. 9 => "Sep",
  337. 10 => "Oct",
  338. 11 => "Nov",
  339. 12 => "Dec"
  340. ],
  341. Date::MONTHS_SHORT
  342. ]
  343. ];
  344. }
  345. /**
  346. * Date::months() should allow the user to specify different format types, defaulting
  347. * to a mirrored month number => month number array if format is NULL or unrecognised
  348. *
  349. * @test
  350. * @dataProvider provider_months
  351. * @covers Date::months
  352. */
  353. public function test_months($expected, $format)
  354. {
  355. $months = Date::months($format);
  356. $this->assertSame($expected, $months);
  357. }
  358. /**
  359. * Provides test data for test_span()
  360. *
  361. * @return array
  362. */
  363. public function provider_span()
  364. {
  365. $time = time();
  366. return [
  367. // Test that it must specify an output format
  368. [
  369. $time,
  370. $time,
  371. '',
  372. FALSE
  373. ],
  374. // Test that providing only one output just returns that output
  375. [
  376. $time - 30,
  377. $time,
  378. 'seconds',
  379. 30
  380. ],
  381. // Random tests
  382. [
  383. $time - 30,
  384. $time,
  385. 'years,months,weeks,days,hours,minutes,seconds',
  386. ['years' => 0, 'months' => 0, 'weeks' => 0, 'days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 30],
  387. ],
  388. [
  389. $time - (60 * 60 * 24 * 782) + (60 * 25),
  390. $time,
  391. 'years,months,weeks,days,hours,minutes,seconds',
  392. ['years' => 2, 'months' => 1, 'weeks' => 3, 'days' => 0, 'hours' => 1, 'minutes' => 28, 'seconds' => 24],
  393. ],
  394. // Should be able to compare with the future & that it only uses formats specified
  395. [
  396. $time + (60 * 60 * 24 * 15) + (60 * 5),
  397. $time,
  398. 'weeks,days,hours,minutes,seconds',
  399. ['weeks' => 2, 'days' => 1, 'hours' => 0, 'minutes' => 5, 'seconds' => 0],
  400. ],
  401. [
  402. // Add a bit of extra time to account for phpunit processing
  403. $time + (14 * 31 * 24* 60 * 60) + (79 * 80),
  404. NULL,
  405. 'months,years',
  406. ['months' => 2, 'years' => 1],
  407. ],
  408. ];
  409. }
  410. /**
  411. * Tests Date::span()
  412. *
  413. * @test
  414. * @covers Date::span
  415. * @dataProvider provider_span
  416. * @param integer $time1 Time in the past
  417. * @param integer $time2 Time to compare against
  418. * @param string $output Units to output
  419. * @param array $expected Array of $outputs => values
  420. */
  421. public function test_span($time1, $time2, $output, $expected)
  422. {
  423. $this->assertSame(
  424. $expected,
  425. Date::span($time1, $time2, $output)
  426. );
  427. }
  428. /**
  429. * Provides test data to test_fuzzy_span
  430. *
  431. * This test data is provided on the assumption that it
  432. * won't take phpunit more than 30 seconds to get the
  433. * data from this provider to the test... ;)
  434. *
  435. * @return array Test Data
  436. */
  437. public function provider_fuzzy_span()
  438. {
  439. $now = time();
  440. return [
  441. ['moments ago', $now - 30, $now],
  442. ['in moments', $now + 30, $now],
  443. ['a few minutes ago', $now - 10*60, $now],
  444. ['in a few minutes', $now + 10*60, $now],
  445. ['less than an hour ago', $now - 45*60, $now],
  446. ['in less than an hour', $now + 45*60, $now],
  447. ['a couple of hours ago', $now - 2*60*60, $now],
  448. ['in a couple of hours', $now + 2*60*60, $now],
  449. ['less than a day ago', $now - 12*60*60, $now],
  450. ['in less than a day', $now + 12*60*60, $now],
  451. ['about a day ago', $now - 30*60*60, $now],
  452. ['in about a day', $now + 30*60*60, $now],
  453. ['a couple of days ago', $now - 3*24*60*60, $now],
  454. ['in a couple of days', $now + 3*24*60*60, $now],
  455. ['less than a week ago', $now - 5*24*60*60, $now],
  456. ['in less than a week', $now + 5*24*60*60, $now],
  457. ['about a week ago', $now - 9*24*60*60, $now],
  458. ['in about a week', $now + 9*24*60*60, $now],
  459. ['less than a month ago', $now - 20*24*60*60, $now],
  460. ['in less than a month', $now + 20*24*60*60, $now],
  461. ['about a month ago', $now - 40*24*60*60, $now],
  462. ['in about a month', $now + 40*24*60*60, $now],
  463. ['a couple of months ago', $now - 3*30*24*60*60, $now],
  464. ['in a couple of months', $now + 3*30*24*60*60, $now],
  465. ['less than a year ago', $now - 7*31*24*60*60, $now],
  466. ['in less than a year', $now + 7*31*24*60*60, $now],
  467. ['about a year ago', $now - 18*31*24*60*60, $now],
  468. ['in about a year', $now + 18*31*24*60*60, $now],
  469. ['a couple of years ago', $now - 3*12*31*24*60*60, $now],
  470. ['in a couple of years', $now + 3*12*31*24*60*60, $now],
  471. ['a few years ago', $now - 5*12*31*24*60*60, $now],
  472. ['in a few years', $now + 5*12*31*24*60*60, $now],
  473. ['about a decade ago', $now - 11*12*31*24*60*60, $now],
  474. ['in about a decade', $now + 11*12*31*24*60*60, $now],
  475. ['a couple of decades ago', $now - 20*12*31*24*60*60, $now],
  476. ['in a couple of decades', $now + 20*12*31*24*60*60, $now],
  477. ['several decades ago', $now - 50*12*31*24*60*60, $now],
  478. ['in several decades', $now + 50*12*31*24*60*60, $now],
  479. ['a long time ago', $now - pow(10,10), $now],
  480. ['in a long time', $now + pow(10,10), $now],
  481. ];
  482. }
  483. /**
  484. * Test of Date::fuzy_span()
  485. *
  486. * @test
  487. * @dataProvider provider_fuzzy_span
  488. * @param string $expected Expected output
  489. * @param integer $timestamp Timestamp to use
  490. * @param integer $local_timestamp The local timestamp to use
  491. */
  492. public function test_fuzzy_span($expected, $timestamp, $local_timestamp)
  493. {
  494. $this->assertSame(
  495. $expected,
  496. Date::fuzzy_span($timestamp, $local_timestamp)
  497. );
  498. }
  499. /**
  500. * Provides test data for test_years()
  501. *
  502. * @return array Test Data
  503. */
  504. public function provider_years()
  505. {
  506. return [
  507. [
  508. [
  509. 2005 => '2005',
  510. 2006 => '2006',
  511. 2007 => '2007',
  512. 2008 => '2008',
  513. 2009 => '2009',
  514. 2010 => '2010',
  515. 2011 => '2011',
  516. 2012 => '2012',
  517. 2013 => '2013',
  518. 2014 => '2014',
  519. 2015 => '2015',
  520. ],
  521. 2005,
  522. 2015
  523. ],
  524. ];
  525. }
  526. /**
  527. * Tests Data::years()
  528. *
  529. * @test
  530. * @dataProvider provider_years
  531. */
  532. public function test_years($expected, $start = FALSE, $end = FALSE)
  533. {
  534. $this->assertSame(
  535. $expected,
  536. Date::years($start, $end)
  537. );
  538. }
  539. public function provider_hours()
  540. {
  541. return [
  542. [
  543. [
  544. 1 => '1',
  545. 2 => '2',
  546. 3 => '3',
  547. 4 => '4',
  548. 5 => '5',
  549. 6 => '6',
  550. 7 => '7',
  551. 8 => '8',
  552. 9 => '9',
  553. 10 => '10',
  554. 11 => '11',
  555. 12 => '12',
  556. ],
  557. ],
  558. ];
  559. }
  560. /**
  561. * Test for Date::hours
  562. *
  563. * @test
  564. * @dataProvider provider_hours
  565. */
  566. public function test_hours($expected, $step = 1, $long = FALSE, $start = NULL)
  567. {
  568. $this->assertSame(
  569. $expected,
  570. Date::hours($step, $long, $start)
  571. );
  572. }
  573. /**
  574. * Provides test data for test_seconds
  575. *
  576. * @return array Test data
  577. */
  578. public function provider_seconds()
  579. {
  580. return [
  581. [
  582. // Thank god for var_export()
  583. [
  584. 0 => '00', 1 => '01', 2 => '02', 3 => '03', 4 => '04',
  585. 5 => '05', 6 => '06', 7 => '07', 8 => '08', 9 => '09',
  586. 10 => '10', 11 => '11', 12 => '12', 13 => '13', 14 => '14',
  587. 15 => '15', 16 => '16', 17 => '17', 18 => '18', 19 => '19',
  588. 20 => '20', 21 => '21', 22 => '22', 23 => '23', 24 => '24',
  589. 25 => '25', 26 => '26', 27 => '27', 28 => '28', 29 => '29',
  590. 30 => '30', 31 => '31', 32 => '32', 33 => '33', 34 => '34',
  591. 35 => '35', 36 => '36', 37 => '37', 38 => '38', 39 => '39',
  592. 40 => '40', 41 => '41', 42 => '42', 43 => '43', 44 => '44',
  593. 45 => '45', 46 => '46', 47 => '47', 48 => '48', 49 => '49',
  594. 50 => '50', 51 => '51', 52 => '52', 53 => '53', 54 => '54',
  595. 55 => '55', 56 => '56', 57 => '57', 58 => '58', 59 => '59',
  596. ],
  597. 1,
  598. 0,
  599. 60
  600. ],
  601. ];
  602. }
  603. /**
  604. *
  605. * @test
  606. * @dataProvider provider_seconds
  607. * @covers Date::seconds
  608. */
  609. public function test_seconds($expected, $step = 1, $start = 0, $end = 60)
  610. {
  611. $this->assertSame(
  612. $expected,
  613. Date::seconds($step, $start, $end)
  614. );
  615. }
  616. /**
  617. * Provides test data for test_minutes
  618. *
  619. * @return array Test data
  620. */
  621. public function provider_minutes()
  622. {
  623. return [
  624. [
  625. [
  626. 0 => '00', 5 => '05', 10 => '10',
  627. 15 => '15', 20 => '20', 25 => '25',
  628. 30 => '30', 35 => '35', 40 => '40',
  629. 45 => '45', 50 => '50', 55 => '55',
  630. ],
  631. 5,
  632. ],
  633. ];
  634. }
  635. /**
  636. *
  637. * @test
  638. * @dataProvider provider_minutes
  639. */
  640. public function test_minutes($expected, $step)
  641. {
  642. $this->assertSame(
  643. $expected,
  644. Date::minutes($step)
  645. );
  646. }
  647. /**
  648. * This tests that the minutes helper defaults to using a $step of 5
  649. * and thus returns an array of 5 minute itervals
  650. *
  651. * @test
  652. * @covers Date::minutes
  653. */
  654. public function test_minutes_defaults_to_using_step_of5()
  655. {
  656. $minutes = [
  657. 0 => '00', 5 => '05', 10 => '10',
  658. 15 => '15', 20 => '20', 25 => '25',
  659. 30 => '30', 35 => '35', 40 => '40',
  660. 45 => '45', 50 => '50', 55 => '55',
  661. ];
  662. $this->assertSame(
  663. $minutes,
  664. Date::minutes()
  665. );
  666. }
  667. /**
  668. * Provids for test_unix2dos
  669. *
  670. * @return array Test Data
  671. */
  672. public function provider_unix2dos()
  673. {
  674. return [
  675. [
  676. 1024341746,
  677. 1281786936
  678. ],
  679. [
  680. 2162688,
  681. 315554400
  682. ]
  683. ];
  684. }
  685. /**
  686. * Test Date::unix2dos()
  687. *
  688. * You should always pass a timestamp as otherwise the current
  689. * date/time would be used and that's oviously variable
  690. *
  691. * Geert seems to be the only person who knows how unix2dos() works
  692. * so we just throw in some random values and see what happens
  693. *
  694. * @test
  695. * @dataProvider provider_unix2dos
  696. * @covers Date::unix2dos
  697. * @param integer $expected Expected output
  698. * @param integer $timestamp Input timestamp
  699. */
  700. public function test_unix2dos($expected, $timestamp)
  701. {
  702. $this->assertSame($expected, Date::unix2dos($timestamp));
  703. }
  704. /**
  705. * Provides test data for test_dos2unix
  706. *
  707. * @return array Test data
  708. */
  709. public function provider_dos2unix()
  710. {
  711. return [
  712. [
  713. 1281786936,
  714. 1024341746,
  715. ],
  716. [
  717. 315554400,
  718. 2162688,
  719. ],
  720. ];
  721. }
  722. /**
  723. * Tests Date::dos2unix
  724. *
  725. * @test
  726. * @dataProvider provider_dos2unix
  727. * @param integer $expected Expected output
  728. * @param integer $timestamp Input timestamp
  729. */
  730. public function test_dos2unix($expected, $timestamp)
  731. {
  732. $this->assertEquals($expected, Date::dos2unix($timestamp));
  733. }
  734. }