Esempio n. 1
0
 public function testFilterProject()
 {
     $u = new User($this->container);
     $n = new Notification($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
     $this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
     // No project selected
     $this->assertTrue($n->filterProject($u->getById(1), array()));
     // User that select only some projects
     $this->assertEquals(2, $u->create(array('username' => 'user2', 'notifications_filter' => Notification::FILTER_NONE)));
     $n->saveSettings(2, array('notifications_enabled' => 1, 'projects' => array(2 => true)));
     $this->assertFalse($n->filterProject($u->getById(2), array('task' => array('project_id' => 1))));
     $this->assertTrue($n->filterProject($u->getById(2), array('task' => array('project_id' => 2))));
 }