1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

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:
epriestley 2017-04-23 06:07:40 -07:00
parent 52c4715bbc
commit bb2b91d28e

View file

@ -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);
}
}
}