This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
forked from mensler/bav
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Clemens Weiß
committed
Jun 23, 2017
1 parent
92c8add
commit 2206555
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace malkusch\bav; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class ValidatorE3Test extends TestCase | ||
{ | ||
private $validator; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$backend = $this->createMock("malkusch\bav\FileDataBackend"); | ||
$bank = $this->createMock( | ||
"malkusch\bav\Bank", array(), array($backend, 1, 'E3')); | ||
|
||
$this->validator = new ValidatorE3($bank); | ||
} | ||
|
||
/** | ||
* @param string $account The account id. | ||
* @param bool $expected The expected validation result. | ||
* | ||
* @dataProvider provideTestData | ||
*/ | ||
public function testIsValid($account, $expected) | ||
{ | ||
$this->assertEquals($expected, $this->validator->isValid($account)); | ||
} | ||
|
||
/** | ||
* Returns test cases for testIsValid(). | ||
* | ||
* @return array Test cases. | ||
*/ | ||
public function provideTestData() | ||
{ | ||
return [ | ||
// variant 1 | ||
['9290701', true], | ||
['539290858', true], | ||
['1501824', true], | ||
['1501832', true], | ||
|
||
// variant 2 | ||
['9290708', true], | ||
['539290854', true], | ||
['1501823', true], | ||
['1501831', true], | ||
['2345678909', true], | ||
['5678901237', true], | ||
|
||
// wrong | ||
['0123456789', false], | ||
['2345678901', false], | ||
['5678901234', false], | ||
['7414398260', false], | ||
]; | ||
} | ||
} |