コード例 #1
0
 /**
  * Regression test for issue #14983
  *
  * @link http://issues.ez.no/14983
  **/
 public function testIssue14983()
 {
     $className = 'eZImageType test class';
     $classIdentifier = 'ezimagetype_test_class';
     $attributeName = 'Image';
     $attributeIdentifier = 'image';
     $attributeType = 'ezimage';
     $filePath = 'tests/tests/kernel/datatypes/ezimage/ezimagetype_regression_issue14983.png';
     $class = new ezpClass($className, $classIdentifier, $className);
     $classAttribute = $class->add($attributeName, $attributeIdentifier, $attributeType);
     $class->store();
     $object = new ezpObject($classIdentifier, 2);
     $object->name = __FUNCTION__;
     $dataMap = $object->object->dataMap();
     $fileAttribute = $dataMap[$attributeIdentifier];
     $dataType = new eZImageType();
     $dataType->fromString($fileAttribute, $filePath);
     $fileAttribute->store();
     $object->publish();
     $object->refresh();
     $contentObjectAttributeID = $fileAttribute->attribute("id");
     $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID);
     $file = $files[0];
     // Read stored path, move to trash, and read stored path again
     $this->assertNotEquals($file, null);
     $oldFile = $file;
     $object->object->removeThis();
     $object->refresh();
     $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID);
     $file = $files[0];
     $this->assertNotEquals($oldFile, $file, 'The stored file should be renamed when trashed');
 }
コード例 #2
0
 public function setUp()
 {
     parent::setUp();
     $classIdentifier = "ezimagetype_test_class";
     $this->imageClass = new ezpClass("eZImageType test class", $classIdentifier, "eZImageType test class");
     $this->imageClass->add("Image", "image", "ezimage");
     $this->imageClass->store();
     $this->imageObject = new ezpObject($classIdentifier, 2);
     $this->imageObject->name = __METHOD__;
     $dataMap = $this->imageObject->object->dataMap();
     $this->fileAttribute = $dataMap["image"];
     $dataType = new eZImageType();
     $dataType->fromString($this->fileAttribute, self::IMAGE_FILE_PATH);
     $this->fileAttribute->store();
     $this->imageObject->publish();
     $this->imageObject->refresh();
 }