Source of file DMSUploadField_ItemHandlerTest.php
Size: 1,030 Bytes - Last Modified: 2021-12-23T10:29:25+00:00
/var/www/docs.ssmods.com/process/src/tests/cms/DMSUploadField_ItemHandlerTest.php
123456789101112131415161718192021222324252627282930313233343536 | <?php class DMSUploadField_ItemHandlerTest extends SapphireTest { protected static $fixture_file = 'dms/tests/dmstest.yml'; /** * @var DMSDocument */ protected $document; public function setUp() { parent::setUp(); $this->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); } } |