forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertTest.php
More file actions
40 lines (33 loc) · 1.71 KB
/
Copy pathAlertTest.php
File metadata and controls
40 lines (33 loc) · 1.71 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
33
34
35
36
37
38
39
40
<?php
class AlertTest extends TestCase {
public function testFinderGenerateWhere() {
$expected = [
['`site_id` = ?', '`archived` = ?', '`alert_date` > ?', '`alert_date` < ?'],
[0, 0, 0, 1]
];
$this->assertSame($expected, FOO\AlertFinder::generateWhere(['from' => 0, 'to' => 1, 'x' => 2]));
}
public function testFinderGetActiveCounts() {
TestHelper::populateDB([
[FOO\Alert::$TABLE, 1, 0, 0, '', '', '', 0, 0, 1, 1, FOO\Alert::ST_RES, FOO\Alert::RES_ACT, 0, 0, 0],
[FOO\Alert::$TABLE, 2, 0, 0, '', '', '', 0, 0, 1, 0, FOO\Alert::ST_INPROG, 0, 0, 0, 0],
[FOO\Alert::$TABLE, 3, 0, 0, '', '', '', 0, 0, 1, 0, FOO\Alert::ST_NEW, 0, 0, 0, 0],
]);
$this->assertEquals([1, 1], FOO\AlertFinder::getActiveCounts());
}
public function testFinderGetRecentSearchHashCount() {
TestHelper::populateDB([
[FOO\Alert::$TABLE, 1, 0, 0, '', 'xxx', '', 0, 0, 1, 1, FOO\Alert::ST_RES, FOO\Alert::RES_ACT, 0, 10, 0],
[FOO\Alert::$TABLE, 2, 0, 0, '', 'xxx', '', 0, 0, 2, 0, FOO\Alert::ST_INPROG, 0, 0, 10, 0],
]);
$this->assertEquals(1, FOO\AlertFinder::getRecentSearchHashCount(1, 'xxx', 0));
}
public function testFinderGetRecentSearchCount() {
TestHelper::populateDB([
[FOO\Alert::$TABLE, 1, 0, 0, '', '', '', 0, 0, 1, 1, FOO\Alert::ST_INPROG, 0, 0, 0, 0],
[FOO\Alert::$TABLE, 2, 0, 0, '', '', '', 0, 0, 1, 1, FOO\Alert::ST_INPROG, 0, 0, 10, 0],
[FOO\Alert::$TABLE, 3, 0, 0, '', '', '', 0, 0, 2, 0, FOO\Alert::ST_INPROG, 0, 0, 10, 0],
]);
$this->assertEquals(1, FOO\AlertFinder::getRecentSearchCount(1, 0));
}
}