1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Tests for FeedsDateTime class.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Test FeedsDateTime class.
|
10
|
*
|
11
|
* Using DrupalWebTestCase as DrupalUnitTestCase is broken in SimpleTest 2.8.
|
12
|
* Not inheriting from Feeds base class as ParserCSV should be moved out of
|
13
|
* Feeds at some time.
|
14
|
*/
|
15
|
class FeedsDateTimeTest extends FeedsWebTestCase {
|
16
|
protected $profile = 'testing';
|
17
|
|
18
|
public static function getInfo() {
|
19
|
return array(
|
20
|
'name' => 'FeedsDateTime unit tests',
|
21
|
'description' => 'Unit tests for Feeds date handling.',
|
22
|
'group' => 'Feeds',
|
23
|
);
|
24
|
}
|
25
|
|
26
|
public function setUp() {
|
27
|
parent::setUp();
|
28
|
module_load_include('inc', 'feeds' , 'plugins/FeedsParser');
|
29
|
}
|
30
|
|
31
|
/**
|
32
|
* Dispatch tests, only use one entry point method testX to save time.
|
33
|
*/
|
34
|
public function test() {
|
35
|
$date = new FeedsDateTime('2010-20-12');
|
36
|
$this->assertTrue(is_numeric($date->format('U')));
|
37
|
$date = new FeedsDateTime('created');
|
38
|
$this->assertTrue(is_numeric($date->format('U')));
|
39
|
$date = new FeedsDateTime('12/3/2009 20:00:10');
|
40
|
$this->assertTrue(is_numeric($date->format('U')));
|
41
|
}
|
42
|
}
|