Skip to content

Commit

Permalink
Fixed failing unit tests (#8)
Browse files Browse the repository at this point in the history
Added new unit tests for new imperial territories added
Fixed bug in guam regex that would validate for everything after 15 characters
  • Loading branch information
adambullmer committed May 23, 2016
1 parent 9a0156d commit e0fa737
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor/
composer.lock
2 changes: 1 addition & 1 deletion regex.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
]
},
"GU" : {
"rule": "^[a-zA-Z]{1}[0-9]{14}",
"rule": "^[A-Z]{1}[0-9]{14}$",
"description": [
"1 Alpha + 14 Numeric"
]
Expand Down
20 changes: 10 additions & 10 deletions test/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ public function test_constructor() {
$this->assertFalse($validator->verbose);
$this->assertFalse($validator->caseInsensitive);
$this->assertEquals(gettype($validator->rules), 'array');
$this->assertCount(51, $validator->rules);
$this->assertCount(53, $validator->rules);
}

public function rule_override_params() {
return array(
array(NULL, FALSE, NULL, FALSE, NULL, 51, 'TX'),
array(TRUE, TRUE, NULL, FALSE, NULL, 51, 'TX'),
array(FALSE, FALSE, NULL, FALSE, NULL, 51, 'TX'),
array(NULL, FALSE, TRUE, TRUE, NULL, 51, 'TX'),
array(TRUE, TRUE, TRUE, TRUE, NULL, 51, 'TX'),
array(FALSE, FALSE, TRUE, TRUE, NULL, 51, 'TX'),
array(NULL, FALSE, FALSE, FALSE, NULL, 51, 'TX'),
array(TRUE, TRUE, FALSE, FALSE, NULL, 51, 'TX'),
array(FALSE, FALSE, FALSE, FALSE, NULL, 51, 'TX'),
array(NULL, FALSE, NULL, FALSE, NULL, 53, 'TX'),
array(TRUE, TRUE, NULL, FALSE, NULL, 53, 'TX'),
array(FALSE, FALSE, NULL, FALSE, NULL, 53, 'TX'),
array(NULL, FALSE, TRUE, TRUE, NULL, 53, 'TX'),
array(TRUE, TRUE, TRUE, TRUE, NULL, 53, 'TX'),
array(FALSE, FALSE, TRUE, TRUE, NULL, 53, 'TX'),
array(NULL, FALSE, FALSE, FALSE, NULL, 53, 'TX'),
array(TRUE, TRUE, FALSE, FALSE, NULL, 53, 'TX'),
array(FALSE, FALSE, FALSE, FALSE, NULL, 53, 'TX'),
array(NULL, FALSE, NULL, FALSE, array('TEST_STATE' => array()), 1, 'TEST_STATE'),
array(TRUE, TRUE, NULL, FALSE, array('TEST_STATE' => array()), 1, 'TEST_STATE'),
array(FALSE, FALSE, NULL, FALSE, array('TEST_STATE' => array()), 1, 'TEST_STATE'),
Expand Down
19 changes: 19 additions & 0 deletions test/features/json.feature
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ Feature: Valid Regex Rules
| GA | 1234567890 | FALSE |
| GA | A12345678 | FALSE |

| GU | A12345678901234 | TRUE |
| GU | AB12345678901234 | FALSE |
| GU | 12345678901234 | FALSE |
| GU | 12345678901234A | FALSE |
| GU | A1234567890123 | FALSE |
| GU | A123456789012345 | FALSE |

| HI | A12345678 | TRUE |
| HI | A123456789 | FALSE |
| HI | A1234567 | FALSE |
Expand Down Expand Up @@ -458,6 +465,18 @@ Feature: Valid Regex Rules
| PA | A1234567 | FALSE |
| PA | 1234567A | FALSE |

| PR | 12345 | TRUE |
| PR | 123456 | TRUE |
| PR | 1234567 | TRUE |
| PR | 12345678 | FALSE |
| PR | 123456789 | TRUE |
| PR | 1234567890 | FALSE |
| PR | 1234 | FALSE |
| PR | A12345 | FALSE |
| PR | 12345A | FALSE |
| PR | A123456789 | FALSE |
| PR | 123456789A | FALSE |

| RI | 1234567 | TRUE |
| RI | 123456 | FALSE |
| RI | 12345678 | FALSE |
Expand Down

0 comments on commit e0fa737

Please sign in to comment.