Skip to content

Commit

Permalink
Add test for key length config
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Jul 23, 2024
1 parent 06364a3 commit d6aa369
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/Unit/Classes/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,19 @@ public function random_url_key_is_generated_if_one_is_not_explicitly_defined():
$shortURL = $builder->destinationUrl('https://domain.com')->make();

$this->assertNotNull($shortURL->url_key);
$this->assertSame(12, strlen($shortURL->url_key));
$this->assertSame(5, strlen($shortURL->url_key));
}

#[Test]
public function short_url_key_length_is_used(): void
{
Config::set('short-url.key_length', 3);

$builder = app(Builder::class);
$shortURL = $builder->destinationUrl('https://domain.com')->make();

$this->assertNotNull($shortURL->url_key);
$this->assertSame(3, strlen($shortURL->url_key));
}

#[Test]
Expand Down

0 comments on commit d6aa369

Please sign in to comment.