forked from etsy/411
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroupTargetTest.php
More file actions
30 lines (24 loc) · 1.08 KB
/
Copy pathGroupTargetTest.php
File metadata and controls
30 lines (24 loc) · 1.08 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
<?php
class GroupTargetTest extends TestCase {
public function testGetEmail() {
TestHelper::populateDB([
[FOO\User::$TABLE, 1, 0, 'user', 'User', '', 'user@test.com', 'UTC', false, '', '', 0, 0, 0]
]);
$grouptarget = new FOO\GroupTarget();
$grouptarget['type'] = FOO\GroupTarget::T_USER;
$grouptarget['user_id'] = 1;
$this->assertSame('user@test.com', $grouptarget->getEmail());
$grouptarget['type'] = FOO\GroupTarget::T_EMAIL;
$grouptarget['data'] = 'user@test.com';
$this->assertSame('user@test.com', $grouptarget->getEmail());
}
public function testFinderGetByGroup() {
TestHelper::populateDB([
[FOO\GroupTarget::$TABLE, 1, 0, 1, FOO\GroupTarget::T_EMAIL, 1, 'test@example.com', 0, 0, 0],
[FOO\GroupTarget::$TABLE, 2, 0, 2, FOO\GroupTarget::T_EMAIL, 1, 'best@example.com', 0, 0, 0],
]);
$grouptargets = FOO\GroupTargetFinder::getByGroup(1);
$this->assertCount(1, $grouptargets);
$this->assertSame(1, $grouptargets[0]['id']);
}
}