Skip to content

Commit

Permalink
Revert "fix #126"
Browse files Browse the repository at this point in the history
This reverts commit 66d0330.
  • Loading branch information
uyab committed Mar 25, 2021
1 parent 66d0330 commit 3ab66e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ public function create($name)
{
$this->name = $name;

$this->setForeground($this->getRandomForeground());
$this->setBackground($this->getRandomBackground());
$this->setFont($this->getRandomFont());
$this->initTheme();

return $this;
}
Expand Down Expand Up @@ -420,7 +418,7 @@ protected function getRandomElement($array, $default)

$name = $this->name;
if (strlen($name) === 0) {
$name = 'laravolt';
$name = chr(rand(65, 90));
}

if (count($array) == 0) {
Expand Down
12 changes: 6 additions & 6 deletions tests/AvatarPhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ public function it_can_resolve_random_themes_and_then_overrides()
'theme' => '*',
'themes' => [
'dark' => [
'backgrounds' => ['#000000'],
'foregrounds' => ['#EEEEEE'],
'backgrounds' => ['#000000', '#111111'],
'foregrounds' => ['#EEEEEE', '#FFFFFF'],
],
'light' => [
'backgrounds' => ['#FFFFFF'],
'foregrounds' => ['#000000'],
'backgrounds' => ['#FFFFFF', '#EEEEEE'],
'foregrounds' => ['#000000', '#111111'],
],
]
];
Expand All @@ -113,8 +113,8 @@ public function it_can_resolve_random_themes_and_then_overrides()
$avatar1 = new \Laravolt\Avatar\Avatar($config);
$avatar1->create($name1)->buildAvatar();

$this->assertEquals('#FFFFFF', $avatar1->getAttribute('background'));
$this->assertEquals('#000000', $avatar1->getAttribute('foreground'));
$this->assertEquals('#000000', $avatar1->getAttribute('background'));
$this->assertEquals('#EEEEEE', $avatar1->getAttribute('foreground'));

$avatar1->setTheme('light')->buildAvatar();
$this->assertEquals('#FFFFFF', $avatar1->getAttribute('background'));
Expand Down

0 comments on commit 3ab66e3

Please sign in to comment.