public function ChargeTest::testInvalidPurchasedEntity in Commerce Recurring Framework 8
@covers ::__construct
File
- tests/
src/ Kernel/ ChargeTest.php, line 33
Class
- ChargeTest
- @coversDefaultClass \Drupal\commerce_recurring\Charge @group commerce_recurring
Namespace
Drupal\Tests\commerce_recurring\KernelCode
public function testInvalidPurchasedEntity() {
$this
->expectException(\InvalidArgumentException::class);
$this
->expectExceptionMessage('The "purchased_entity" property must be an instance of Drupal\\commerce\\PurchasableEntityInterface.');
$charge = new Charge([
'purchased_entity' => 'INVALID',
'title' => 'My subscription',
'unit_price' => new Price('99.99', 'USD'),
'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')),
]);
}