Commit 28524891 authored by Tino Goratsch's avatar Tino Goratsch

added unit tests for the ChangePasswordValidationRule and IntegerValidationRule

parent ae909771
<?php
class ChangePasswordValidationRuleTest extends AbstractValidationRuleTest
{
protected function setUp()
{
$this->validationRule = new \ACP3\Core\Validation\ValidationRules\ChangePasswordValidationRule();
}
/**
* @return array
*/
public function validationRuleProvider()
{
return [
'valid-data-array' => [['pw' => 'test1234', 'pw_confirm' => 'test1234'], ['pw', 'pw_confirm'], [], true],
'valid-with-empty-confirm-value-data-array' => [['pw' => 'test1234', 'pw_confirm' => ''], ['pw', 'pw_confirm'], [], true],
'valid-with-empty-values-data-array-' => [['pw' => '', 'pw_confirm' => ''], ['pw', 'pw_confirm'], [], true],
'invalid-data-array' => [['pw' => 'test1234'], ['pw'], [], false],
'invalid-data-flat-array' => [['test1234'], [], [], false],
'invalid-data-string' => ['foobar', '', [], false],
'invalid-no-data' => [null, null, [], false]
];
}
}
\ No newline at end of file
<?php
class IntegerValidationRuleTest extends AbstractValidationRuleTest
{
protected function setUp()
{
$this->validationRule = new \ACP3\Core\Validation\ValidationRules\IntegerValidationRule();
}
/**
* @return array
*/
public function validationRuleProvider()
{
return [
'valid-data-integer' => [1, '', [], true],
'valid-data-string' => ['1', '', [], true],
'valid-data-array-integer' => [['foo' => 1], 'foo', [], true],
'valid-data-array-string' => [['foo' => '1'], 'foo', [], true],
'invalid-data-string' => ['foobar', '', [], false],
'invalid-data-float' => [0.01, '', [], false],
'invalid-data-float-as-string' => ['0.01', '', [], false],
'invalid-data-array' => [['foo' => 'foobar'], 'foo', [], false],
'invalid-no-data' => [null, null, [], false]
];
}
}
\ No newline at end of file
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