6fcde9f836e078510055372fb3b93f5d039a05d3
3 require_once 'CiviTest/CiviUnitTestCase.php';
6 * Class CRM_Utils_RuleTest
8 class CRM_Utils_RuleTest
extends CiviUnitTestCase
{
15 'name' => 'Rule Test',
16 'description' => 'Test the validation rules',
17 'group' => 'CiviCRM BAO Tests',
26 * @dataProvider integerDataProvider
28 function testInteger($inputData, $expectedResult) {
29 $this->assertEquals($expectedResult, CRM_Utils_Rule
::integer($inputData));
35 function integerDataProvider() {
38 array('145E+3', FALSE),
42 array('-10foo', FALSE),
47 * @dataProvider positiveDataProvider
49 function testPositive($inputData, $expectedResult) {
50 $this->assertEquals($expectedResult, CRM_Utils_Rule
::positiveInteger($inputData));
56 function positiveDataProvider() {
59 array('145.0E+3', FALSE),
63 array('-10foo', FALSE),
68 * @dataProvider numericDataProvider
70 function testNumeric($inputData, $expectedResult) {
71 $this->assertEquals($expectedResult, CRM_Utils_Rule
::numeric($inputData));
77 function numericDataProvider() {
80 array('145.0E+3', FALSE),
84 array('-10foo', FALSE),