public function ChargeTest::testInvalidUnitPrice in Commerce Recurring Framework 8
@covers ::__construct
File
- tests/src/ Kernel/ ChargeTest.php, line 54 
Class
- ChargeTest
- @coversDefaultClass \Drupal\commerce_recurring\Charge @group commerce_recurring
Namespace
Drupal\Tests\commerce_recurring\KernelCode
public function testInvalidUnitPrice() {
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('The "unit_price" property must be an instance of Drupal\\commerce_price\\Price.');
  $charge = new Charge([
    'title' => 'My subscription',
    'unit_price' => 'INVALID',
    'billing_period' => new BillingPeriod(DrupalDateTime::createFromFormat('Y-m-d', '2019-01-01'), DrupalDateTime::createFromFormat('Y-m-d', '2019-02-01')),
    'full_billing_period' => new BillingPeriod(DrupalDateTime::createFromFormat('Y-m-d', '2019-01-01'), DrupalDateTime::createFromFormat('Y-m-d', '2019-02-01')),
  ]);
}