/** * Test getTo method */ public function testGetNotificationRecipients() { $todoModel = new Todo_Models_Todo(); $todoModel->find(2); $response = $todoModel->getNotification()->getTo(); $expected = array(); $this->assertEquals($expected, $response); $todoModel->userId = 2; $todoModel->save(); $response = $todoModel->getNotification()->getTo(); $expected = array(2); $this->assertEquals($expected, $response); $todoModel->userId = 3; $todoModel->save(); $response = $todoModel->getNotification()->getTo(); $expected = array(3, 2); $this->assertEquals($expected, $response); }
/** * Test getRights function */ public function testGetUsersRights() { $module = new Project_Models_Project(array('db' => $this->sharedFixture)); $module->find(2); $rights = $module->getUsersRights(); $this->assertArrayHasKey(3, $rights); $this->assertArrayHasKey('itemId', $rights[3]); $this->assertEquals($rights[3]['itemId'], 2); $this->assertArrayHasKey('write', $rights[3]); $this->assertEquals($rights[3]['write'], true); $module = new Todo_Models_Todo(array('db' => $this->sharedFixture)); $this->assertEquals(array(), $module->getUsersRights()); }