Skip to content

Commit

Permalink
fix typo lol
Browse files Browse the repository at this point in the history
  • Loading branch information
nemoitis committed Mar 5, 2024
1 parent 1bf9547 commit 9a3c203
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/SvgAvatarGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function getGradientRotation(): int
*/
public function setGradientRotation(int $angle): static
{
ConfigValidator::validate('gradiant_rotation', $angle);
ConfigValidator::validate('gradient_rotation', $angle);

$this->gradientRotation = $angle;

Expand Down Expand Up @@ -362,7 +362,7 @@ public function getGradientStops(): array
*/
public function setGradientStops(int|float ...$offsets): static
{
ConfigValidator::validate('gradiant_stops', $offsets);
ConfigValidator::validate('gradient_stops', $offsets);

$this->gradientStops = $offsets;

Expand Down
6 changes: 3 additions & 3 deletions src/Validators/ConfigValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class ConfigValidator
protected static array $rules = [
'corner_radius' => ['int', 'between:0,25'],
'font_size' => ['int', 'between:10,50'],
'gradiant_rotation' => ['int', 'between:0,360'],
'gradiant_stops' => ['array'],
'gradiant_stops.*' => ['numeric', 'between:0,1'],
'gradient_rotation' => ['int', 'between:0,360'],
'gradient_stops' => ['array'],
'gradient_stops.*' => ['numeric', 'between:0,1'],
'svg_size' => ['int', 'between:16,512'],
'custom_font_url' => ['nullable', 'url'],
'svg_text' => ['required', 'string'],
Expand Down
8 changes: 4 additions & 4 deletions tests/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
it('will throw exception if gradient rotation less than minimum is provided', function () {
config(['svg-avatar.gradient_rotation' => -1]);
new SvgAvatarGenerator('Brandon Stark');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradiant rotation(?: field)? must be between 0 and 360/');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradient rotation(?: field)? must be between 0 and 360/');

it('will throw exception if gradient rotation greater than maximum is provided', function () {
config(['svg-avatar.gradient_rotation' => 361]);
new SvgAvatarGenerator('Rickon Stark');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradiant rotation(?: field)? must be between 0 and 360/');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradient rotation(?: field)? must be between 0 and 360/');

it('will throw missing text exception if text is not set', function () {
$generator = new SvgAvatarGenerator();
Expand All @@ -41,12 +41,12 @@
it('will throw exception if gradient stop less than minimum is provided', function () {
config(['svg-avatar.gradient_stops' => [-1, 0.5]]);
new SvgAvatarGenerator('Lyanna Stark');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradiant_stops.0(?: field)? must be between 0 and 1/');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradient_stops.0(?: field)? must be between 0 and 1/');

it('will throw exception if gradient stop greater than maximum is provided', function () {
config(['svg-avatar.gradient_stops' => [0.2, 2]]);
new SvgAvatarGenerator('Benjen Stark');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradiant_stops.1(?: field)? must be between 0 and 1/');
})->throws(ValidationException::class)->expectExceptionMessageMatches('/The gradient_stops.1(?: field)? must be between 0 and 1/');

it('will throw exception if invalid font url is provided', function () {
config(['svg-avatar.custom_font_url' => 'invalid_url']);
Expand Down

0 comments on commit 9a3c203

Please sign in to comment.