Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Tested new card type.
Browse files Browse the repository at this point in the history
  • Loading branch information
shlaikov authored and Алексей Шлайков committed Oct 5, 2017
1 parent 436968a commit 6aecdc7
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion test/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testGetMessages()
public function testGetSetType()
{
$validator = new CreditCard();
$this->assertEquals(11, count($validator->getType()));
$this->assertEquals(12, count($validator->getType()));

$validator->setType(CreditCard::MAESTRO);
$this->assertEquals([CreditCard::MAESTRO], $validator->getType());
Expand Down Expand Up @@ -253,6 +253,45 @@ public function testMastercardCard($input, $expected)
$this->assertEquals($expected, $validator->isValid($input));
}

/**
* Data provider
*
* @return string[][]|bool[][]
*/
public function mirValues()
{
return [
['3011111111111000', false],
['2031343323344731', false],
['2200312032822721', true],
['2209993834549400', false],
['2204001882200999', true],
['2202000312124573', true],
['2203921957923012', true],
['2204150479254495', true],
['2201123406612104', true],
['2900008996056', false],
['2201969950494', true],
['2201342387927', true],
['2205969950494', false],
];
}

/**
* Test mir card number validity
*
* @dataProvider mirValues
*
* @param string $input
* @param bool $expected
*/
public function testMirCard($input, $expected)
{
$validator = new CreditCard(['type' => CreditCard::MIR]);

$this->assertEquals($expected, $validator->isValid($input));
}

/**
* Test an invalid service class
*
Expand Down

0 comments on commit 6aecdc7

Please sign in to comment.