You are here

public function CardExpirationTest::providerValidCardExpirationDate in Creditfield Form Element 8

Data provider of valid dates. Includes variants that should pass validation. Since our validator simply checks that the date is in the future, any future month/year combo should pass.

Return value

array

File

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

Class

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

Namespace

Drupal\Tests\creditfield\Unit\Element

Code

public function providerValidCardExpirationDate() {
  $year = date('Y') + 1;
  return [
    [
      $year . '-' . '01',
    ],
    [
      $year + 1 . '-' . '03',
    ],
    [
      $year + 2 . '-' . '07',
    ],
    [
      $year + 2 . '-' . '12',
    ],
    [
      date('Y') . '-' . date('m'),
    ],
  ];
}