mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Added more tests covering invalid custom slugs
This commit is contained in:
@@ -44,7 +44,10 @@ class ShortUrlMetaInputFilter extends InputFilter
|
||||
// empty, is by using the deprecated setContinueIfEmpty
|
||||
$customSlug = $this->createInput(self::CUSTOM_SLUG, false)->setContinueIfEmpty(true);
|
||||
$customSlug->getFilterChain()->attach(new Validation\SluggerFilter());
|
||||
$customSlug->getValidatorChain()->attach(new Validator\NotEmpty(Validator\NotEmpty::STRING));
|
||||
$customSlug->getValidatorChain()->attach(new Validator\NotEmpty([
|
||||
Validator\NotEmpty::STRING,
|
||||
Validator\NotEmpty::SPACE,
|
||||
]));
|
||||
$this->add($customSlug);
|
||||
|
||||
$this->add($this->createPositiveNumberInput(self::MAX_VISITS));
|
||||
|
||||
@@ -47,6 +47,15 @@ class ShortUrlMetaTest extends TestCase
|
||||
yield [[
|
||||
ShortUrlMetaInputFilter::SHORT_CODE_LENGTH => 3,
|
||||
]];
|
||||
yield [[
|
||||
ShortUrlMetaInputFilter::CUSTOM_SLUG => '/',
|
||||
]];
|
||||
yield [[
|
||||
ShortUrlMetaInputFilter::CUSTOM_SLUG => '',
|
||||
]];
|
||||
yield [[
|
||||
ShortUrlMetaInputFilter::CUSTOM_SLUG => ' ',
|
||||
]];
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
||||
Reference in New Issue
Block a user