Add unit tests for file thumbnail generation
Summary: Fixes T12614. Test Plan: - Ran tests, saw them pass. - Changed a thumbnail to 800x800, saw tests detect that the default image was missing. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12614 Differential Revision: https://secure.phabricator.com/D17773
This commit is contained in:
		| @@ -2,9 +2,33 @@ | ||||
|  | ||||
| final class PhabricatorFileTransformTestCase extends PhabricatorTestCase { | ||||
|  | ||||
|   protected function getPhabricatorTestCaseConfiguration() { | ||||
|     return array( | ||||
|       self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   public function testGetAllTransforms() { | ||||
|     PhabricatorFileTransform::getAllTransforms(); | ||||
|     $this->assertTrue(true); | ||||
|   } | ||||
|  | ||||
|   public function testThumbTransformDefaults() { | ||||
|     $xforms = PhabricatorFileTransform::getAllTransforms(); | ||||
|     $file = new PhabricatorFile(); | ||||
|  | ||||
|     foreach ($xforms as $xform) { | ||||
|       if (!($xform instanceof PhabricatorFileThumbnailTransform)) { | ||||
|         continue; | ||||
|       } | ||||
|  | ||||
|       // For thumbnails, generate the default thumbnail. This should be able | ||||
|       // to generate something rather than throwing an exception because we | ||||
|       // forgot to add a default file to the builtin resources. See T12614. | ||||
|       $xform->getDefaultTransform($file); | ||||
|  | ||||
|       $this->assertTrue(true); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley