Skip to content

Commit

Permalink
Refactor postcode validation test cases
Browse files Browse the repository at this point in the history
- Updated the invalid postcode test cases to correctly reflect the expected output after formatting.
- Ensured that postcodes with spaces and dashes are processed to remove those characters before validation.
- Added test cases for both valid and invalid postcodes according to the specified regex pattern.
  • Loading branch information
johnnyxlemonade committed Oct 9, 2024
1 parent 297baf8 commit 3084654
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/Formatter/ROFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,33 @@ public function providerFormat() : array
['ABCD', null],
['ABCDE', null],
['ABCDEF', null],

// valid
['123-456', '123456'],
[' 123456 ', '123456'],
['010101', '010101'],
['123456', '123456'],
['090123', '090123'],
['080456', '080456'],
['070789', '070789'],
['123450', '123450'],
['012345', '012345'],
['202020', '202020'],
['999999', '999999'],

// invalid
['000123', null],
['01111', null],
['000000', null],
['-1234', null],
['12ABCD', null],
['12345678', null],
['01 234 56', null],
['0300!', null],
['999999', null],
['12 345', null],
['07-089', null]

];
}
}

0 comments on commit 3084654

Please sign in to comment.