/** * Test text converter */ public function testConvertPart1() { $model = new Project_Models_Project(); $order = Phprojekt_ModelInformation_Default::ORDERING_FORM; $fieldDefinition = $model->getInformation()->getFieldDefinition($order); $object = $model->find(1); foreach ($fieldDefinition as $info) { // Selectbox if ($info['key'] == 'currentStatus') { $value = Phprojekt_Converter_Text::convert($object, $info); $this->assertEquals('Working', $value); } // Percentage if ($info['key'] == 'completePercent') { $value = Phprojekt_Converter_Text::convert($object, $info); $this->assertEquals('0.00', $value); } // Text if ($info['key'] == 'title') { $value = Phprojekt_Converter_Text::convert($object, $info); $this->assertEquals($object->title, $value); } // TextArea if ($info['key'] == 'notes') { $value = Phprojekt_Converter_Text::convert($object, $info); $this->assertEquals($object->notes, $value); } // Date if ($info['key'] == 'startDate') { $value = Phprojekt_Converter_Text::convert($object, $info); $this->assertEquals($object->startDate, $value); } } }
/** * Test getRangeFromModel method */ public function testGetRangeFromModel() { $contactModel = clone $this->_model; $projectModel = new Project_Models_Project(); $projectModel->find(1); $field = new Phprojekt_DatabaseManager_Field($projectModel->getInformation(), 'contactId'); $response = $contactModel->getRangeFromModel($field); $expected = array(array('id' => 0, 'name' => ''), array('id' => '2', 'name' => 'Mariano10')); $this->assertEquals($expected, $response); }