You are here

public function ChargeTest::testInvalidBillingPeriod in Commerce Recurring Framework 8

@covers ::__construct

File

tests/src/Kernel/ChargeTest.php, line 74

Class

ChargeTest
@coversDefaultClass \Drupal\commerce_recurring\Charge @group commerce_recurring

Namespace

Drupal\Tests\commerce_recurring\Kernel

Code

public function testInvalidBillingPeriod() {
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('The "billing_period" property must be an instance of Drupal\\commerce_recurring\\BillingPeriod.');
  $charge = new Charge([
    'title' => 'My subscription',
    'unit_price' => new Price('99.99', 'USD'),
    'billing_period' => 'INVALID',
    'full_billing_period' => new BillingPeriod(DrupalDateTime::createFromFormat('Y-m-d', '2019-01-01'), DrupalDateTime::createFromFormat('Y-m-d', '2019-02-01')),
  ]);
}