Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/validator-bol #16

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.5] - 2024-07-24

### Fixed
- The length of the Bolivian account was changed from 22 to between 10-22 digits.

## [1.1.4] - 2024-07-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Bo/BoBankAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getAccountTile(): string

public function isValid(): bool
{
if (preg_match('/^([a-zA-Z]{3})\+([0-9]{22})$/', $this->bank_account_number) !== 1) {
if (preg_match('/^([a-zA-Z]{3})\+([0-9]{10,22})$/', $this->bank_account_number) !== 1) {
return false;
}

Expand Down
17 changes: 9 additions & 8 deletions tests/Bo/BoBankAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@ final class BoBankAccountTest extends TestCase
public function testIsValid(): void
{
static::assertFalse((new BoBankAccount(''))->isValid());
static::assertFalse((new BoBankAccount('111111111'))->isValid());
static::assertFalse((new BoBankAccount('WQE+111111111'))->isValid());
static::assertFalse((new BoBankAccount('AAAAA0000'))->isValid());
static::assertFalse((new BoBankAccount('01340946340001361695'))->isValid());
static::assertFalse((new BoBankAccount('AAAAA0000'))->isValid());
static::assertFalse((new BoBankAccount('01050194651194-079423'))->isValid());
static::assertFalse((new BoBankAccount('01050194651194079423 More text?'))->isValid());
static::assertTrue((new BoBankAccount('ASD+1234567891234567891234'))->isValid());
static::assertFalse((new BoBankAccount('ASD+013409'))->isValid());
static::assertFalse((new BoBankAccount('ASD+0105019465114-07'))->isValid());
static::assertFalse((new BoBankAccount('ASD+0105019465119407 More text?'))->isValid());
static::assertFalse((new BoBankAccount('ASD+12345678913423511616123'))->isValid());
static::assertTrue((new BoBankAccount('ASD+1234567891342351161612'))->isValid());
static::assertTrue((new BoBankAccount('ASD+2345678912'))->isValid());
}

public function testBankName(): void
{
static::assertNull((new BoBankAccount('00050194697194012294'))->getBankName());
static::assertNull((new BoBankAccount('00050194697194'))->getBankName());
}

public function testAccountTile(): void
{
static::assertSame('CCI', (new BoBankAccount('01050194697194012294'))->getAccountTile());
static::assertSame('CCI', (new BoBankAccount('01050194697194'))->getAccountTile());
}
}
Loading