Example #1
0
 /**
  * Test getTo method
  */
 public function testGetNotificationRecipients()
 {
     $helpdeskModel = new Helpdesk_Models_Helpdesk();
     $helpdeskModel->find(1);
     $response = $helpdeskModel->getNotification()->getTo();
     $expected = array();
     $this->assertEquals($expected, $response);
     $helpdeskModel->find(2);
     $helpdeskModel->assigned = 2;
     $helpdeskModel->save();
     $helpdeskModel->assigned = 1;
     $helpdeskModel->save();
     $response = $helpdeskModel->getNotification()->getTo();
     $expected = array(2);
     $this->assertEquals($expected, $response);
 }
Example #2
0
 /**
  * Test text converter
  */
 public function testConvertPart3()
 {
     $this->markTestIncomplete('do not use helpdesk');
     $model = new Helpdesk_Models_Helpdesk();
     $order = Phprojekt_ModelInformation_Default::ORDERING_FORM;
     $fieldDefinition = $model->getInformation()->getFieldDefinition($order);
     $model->title = 'test';
     $model->projectId = 1;
     $model->ownerId = 1;
     $model->attachments = '3bc3369dd33d3ab9c03bd76262cff633|LICENSE';
     $model->status = 3;
     $model->author = 2;
     foreach ($fieldDefinition as $info) {
         // Upload
         if ($info['key'] == 'attachments') {
             $value = Phprojekt_Converter_Text::convert($model, $info);
             $this->assertEquals('LICENSE', $value);
             $model->attachments = '6d54feaa915a99cce5850d7812ade10e|LICENSE|' . '|0620dbcea94f89e8154682d21bc327b0|install.log';
             $value = Phprojekt_Converter_Text::convert($model, $info);
             $this->assertEquals('LICENSE, install.log', $value);
         }
         // Display
         if ($info['key'] == 'author') {
             $value = Phprojekt_Converter_Text::convert($model, $info);
             $this->assertEquals('Solt, Gustavo', $value);
             $model->author = 100;
             $value = Phprojekt_Converter_Text::convert($model, $info);
             $this->assertEquals('100', $value);
         }
     }
 }
Example #3
0
 public function testSaveRights()
 {
     $this->markTestSkipped('Do not use Helpdesk model outside of Helpdesk tests');
     $model = new Helpdesk_Models_Helpdesk(array('db' => $this->sharedFixture));
     $model->title = 'test';
     $model->projectId = 1;
     $model->ownerId = 1;
     $model->attachments = '3bc3369dd33d3ab9c03bd76262cff633|LICENSE';
     $model->status = 3;
     $model->author = 1;
     $model->save();
     $model->saveRights(array(1 => 255));
     $rights = new Phprojekt_Item_Rights();
     $this->assertEquals(255, $rights->getItemRight(10, $model->id, 1));
     $this->assertEquals(0, $rights->getItemRight(10, $model->id, 10));
 }
Example #4
0
 public function testSaveRights()
 {
     $model = new Helpdesk_Models_Helpdesk(array('db' => $this->sharedFixture));
     $model->title = 'test';
     $model->projectId = 1;
     $model->ownerId = 1;
     $model->attachments = '3bc3369dd33d3ab9c03bd76262cff633|LICENSE';
     $model->status = 3;
     $model->author = 1;
     $model->save();
     $model->saveRights(array(1 => 255));
     $rights = Phprojekt_Loader::getLibraryClass('Phprojekt_Item_Rights');
     $this->assertEquals(255, $rights->getItemRight(10, $model->id, 1));
     $this->assertEquals(0, $rights->getItemRight(10, $model->id, 10));
 }