You are here

public function CardExpirationTest::providerInvalidCardExpirationDate in Creditfield Form Element 8

Data provider of invalid dates. Since our validator simply checks that the date is in the future, any past month/year combo should fail. The current date should also fail.

Return value

array

File

tests/src/Unit/Element/CardExpirationTest.php, line 52

Class

CardExpirationTest
@coversDefaultClass \Drupal\creditfield\Element\CardExpiration @group creditfield

Namespace

Drupal\Tests\creditfield\Unit\Element

Code

public function providerInvalidCardExpirationDate() {
  $year = date('Y') - 3;
  return [
    [
      $year . '-' . '01',
    ],
    [
      $year + 1 . '-' . '09',
    ],
    [
      $year + 2 . '-' . '04',
    ],
    [
      $year + 2 . '-' . '13',
    ],
    [
      $year + 2 . '-' . '-2',
    ],
    [
      $year + 2 . '-' . '0',
    ],
    [
      $year + 1 . '-' . '24',
    ],
    [
      $year - 5 . '-' . '13',
    ],
    [
      $year - 5 . '-' . '32',
    ],
    [
      date('Y') . '-' . (date('m') - 1),
    ],
  ];
}