forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReportTest.php
More file actions
32 lines (28 loc) · 1.42 KB
/
Copy pathReportTest.php
File metadata and controls
32 lines (28 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class ReportTest extends TestCase {
public function testGetSearches() {
TestHelper::populateDB([
[FOO\ReportTarget::$TABLE, 1, 0, 1, 1, 0, 0, 0, 0],
[FOO\ReportTarget::$TABLE, 2, 0, 2, 1, 0, 0, 0, 0],
[FOO\Search::$TABLE, 1, 0, 'One', 'null', '', '', '', '', '', FOO\Search::$CATEGORIES['general'], '', FOO\Search::P_LOW, FOO\Search::SCT_FREQ, 1, '', 1, true, 0, 0, 0, 0.0, FOO\Search::NT_ONDEMAND, FOO\Search::NF_FULL, '', 0, '', 0, 0, 0, 0, 0, 0, 0],
[FOO\Search::$TABLE, 2, 0, 'Two', 'null', '', '', '', '', '', FOO\Search::$CATEGORIES['general'], '', FOO\Search::P_LOW, FOO\Search::SCT_FREQ, 1, '', 1, true, 0, 0, 0, 0.0, FOO\Search::NT_ONDEMAND, FOO\Search::NF_FULL, '', 0, '', 0, 0, 0, 0, 0, 0, 0],
]);
$report = new FOO\Report();
$report->setId(1);
$report['type'] = FOO\Report::T_SEL;
$searches = $report->getSearches();
$this->assertCount(1, $searches);
$this->assertSame(1, $searches[0]['id']);
$report['type'] = FOO\Report::T_AA;
$searches = $report->getSearches();
$this->assertCount(2, $searches);
}
public function testShouldRun() {
$report = new FOO\Report();
$report['start_date'] = 0;
$report['frequency'] = 1;
$day = 24 * 60 * 60;
$this->assertFalse($report->shouldRun($day - 10));
$this->assertTrue($report->shouldRun($day));
}
}