Commit e52b2865 authored by Tino Goratsch's avatar Tino Goratsch

added unit tests for the BirthdayValidationRule, InternalUriValidationRule and...

added unit tests for the BirthdayValidationRule, InternalUriValidationRule and UriSafeValidationRule classes
parent 28524891
<?php
class BirthdayValidationRuleTest extends AbstractValidationRuleTest
{
protected function setUp()
{
$this->validationRule = new \ACP3\Core\Validation\ValidationRules\BirthdayValidationRule();
}
/**
* @return array
*/
public function validationRuleProvider()
{
return [
'valid-data-string' => ['1980-03-20', '', [], true],
'valid-data-array' => [['foo' => '1980-03-20'], 'foo', [], true],
'invalid-data-string-with-time' => ['1980-03-20 20:00:00', '', [], false],
'invalid-data-string-random-string' => ['abc/1234/test', '', [], false],
];
}
}
\ No newline at end of file
<?php
class InternalUriValidationRuleTest extends AbstractValidationRuleTest
{
protected function setUp()
{
$this->validationRule = new \ACP3\Core\Validation\ValidationRules\InternalUriValidationRule();
}
/**
* @return array
*/
public function validationRuleProvider()
{
return [
'valid-data-string' => ['abc/1234/test/', '', [], true],
'valid-data-array' => [['foo' => 'abc/1234/test/'], 'foo', [], true],
'invalid-data-string-two-segments' => ['abc/1234/', '', [], false],
'invalid-data-string-missing-trailing-slash' => ['abc/1234/test', '', [], false],
'invalid-data-string-with-uppercase-letters' => ['A12abc/1234/test/', '', [], false],
];
}
}
\ No newline at end of file
<?php
class UriSafeValidationRuleTest extends AbstractValidationRuleTest
{
protected function setUp()
{
$this->validationRule = new \ACP3\Core\Validation\ValidationRules\UriSafeValidationRule();
}
/**
* @return array
*/
public function validationRuleProvider()
{
return [
'valid-data-string' => ['abc/1234', '', [], true],
'invalid-data-string-with-umlauts' => ['abüöc/1234', '', [], false],
'invalid-data-string-with-beginning-number' => ['12abc/1234', '', [], false],
'invalid-data-string-with-uppercase-letters' => ['A12abc/1234', '', [], false],
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment