2 /***************************************************************
5 * (c) 2012 Andreas Lappe <a.lappe@kuehlhaus.com>, kuehlhaus AG
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
18 * This script is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * This copyright notice MUST APPEAR in all copies of the script!
24 ***************************************************************/
27 * Test case for class \TYPO3\CMS\Form\Validation\GreaterThanValidator.
29 * @author Andreas Lappe <a.lappe@kuehlhaus.com>
33 class GreaterThanValidatorTest
extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase
{
35 * @var \TYPO3\CMS\Form\Tests\Unit\Validation\Helper
40 * @var \TYPO3\CMS\Form\Validation\GreaterThanValidator
44 public function setUp() {
45 $this->helper
= new \TYPO3\CMS\Form\Tests\Unit\Validation\
Helper();
46 $this->fixture
= new \TYPO3\CMS\Form\Validation\
GreaterThanValidator(array());
49 public function tearDown() {
50 unset($this->helper
, $this->fixture
);
53 public function validNumberProvider() {
55 '13 > 12' => array(array(12, 13)),
59 public function invalidNumberProvider() {
61 '12.1 > 12' => array(array(12, 12.1)),
62 '12 > 12' => array(array(12, 12)),
63 '11.99 > 12' => array(array(12, 11.99))
69 * @dataProvider validNumberProvider
71 public function isValidForValidInputReturnsTrue($input) {
72 $this->fixture
->setFieldName('myFile');
73 $this->fixture
->setMinimum($input[0]);
74 $requestHandlerMock = $this->helper
->getRequestHandler(array(
77 $this->fixture
->injectRequestHandler($requestHandlerMock);
80 $this->fixture
->isValid()
86 * @dataProvider invalidNumberProvider
88 public function isValidForInvalidInputReturnsFalse($input) {
89 $this->fixture
->setFieldName('myFile');
90 $this->fixture
->setMinimum($input[0]);
91 $requestHandlerMock = $this->helper
->getRequestHandler(array(
94 $this->fixture
->injectRequestHandler($requestHandlerMock);
97 $this->fixture
->isValid()