mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-11 07:11:04 +01:00
Don't require the "gd" extension be installed in order to run unit tests
Summary: Ref T10405. If `gd` is not installed, a number of unit tests currently fail because they generate synthetic users and try to composite profile pictures for them. Instead, just fall back to a static default if `gd` is not available. Test Plan: Faked this pathway, created a new user, saw a default profile picture. Reviewers: amckinley, lpriestley, avivey Reviewed By: avivey Maniphest Tasks: T10405 Differential Revision: https://secure.phabricator.com/D18812
This commit is contained in:
parent
0807b70ea1
commit
f786c86a6a
1 changed files with 8 additions and 0 deletions
|
@ -58,6 +58,14 @@ final class PhabricatorFilesComposeAvatarBuiltinFile
|
||||||
}
|
}
|
||||||
|
|
||||||
private function composeImage($color, $image, $border) {
|
private function composeImage($color, $image, $border) {
|
||||||
|
// If we don't have the GD extension installed, just return a static
|
||||||
|
// default profile image rather than trying to compose a dynamic one.
|
||||||
|
if (!function_exists('imagecreatefromstring')) {
|
||||||
|
$root = dirname(phutil_get_library_root('phabricator'));
|
||||||
|
$default_path = $root.'/resources/builtin/profile.png';
|
||||||
|
return Filesystem::readFile($default_path);
|
||||||
|
}
|
||||||
|
|
||||||
$color_const = hexdec(trim($color, '#'));
|
$color_const = hexdec(trim($color, '#'));
|
||||||
$true_border = self::rgba2gd($border);
|
$true_border = self::rgba2gd($border);
|
||||||
$image_map = self::getImageMap();
|
$image_map = self::getImageMap();
|
||||||
|
|
Loading…
Reference in a new issue