diff --git a/tests/cms/DMSUploadField_ItemHandlerTest.php b/tests/cms/DMSUploadField_ItemHandlerTest.php new file mode 100644 index 0000000..f79d533 --- /dev/null +++ b/tests/cms/DMSUploadField_ItemHandlerTest.php @@ -0,0 +1,35 @@ +document = $this->objFromFixture('DMSDocument', 'd1'); + } + + public function testGetItem() + { + $handler = new DMSUploadField_ItemHandler(DMSUploadField::create('Test'), $this->document->ID); + $result = $handler->getItem(); + $this->assertSame($result->ID, $this->document->ID, 'getItem returns the correct document from the database'); + } + + public function testEditForm() + { + $handler = new DMSUploadField_ItemHandler(DMSUploadField::create('Test'), $this->document->ID); + $result = $handler->EditForm(); + + $this->assertInstanceOf('Form', $result); + $this->assertInstanceOf('DMSDocument', $result->getRecord()); + $this->assertSame($this->document->ID, $result->getRecord()->ID); + } +}