public function ScheduledChangeItemTest::testScheduledChangeItem in Commerce Recurring Framework 8
Tests the scheduled change item.
File
- tests/
src/ Kernel/ ScheduledChangeItemTest.php, line 55
Class
- ScheduledChangeItemTest
- Tests the scheduled change field.
Namespace
Drupal\Tests\commerce_recurring\KernelCode
public function testScheduledChangeItem() {
/** @var \Drupal\Core\Field\FieldItemListInterface $scheduled_change_item_list */
$scheduled_change_item_list = $this->testEntity->test_scheduled_changes;
$scheduled_change_item_list
->appendItem(new ScheduledChange('state', 'canceled', time()));
/** @var \Drupal\commerce_recurring\ScheduledChange $scheduled_change */
$scheduled_change = $scheduled_change_item_list
->first()
->toScheduledChange();
$this
->assertEquals('state', $scheduled_change
->getFieldName());
$this
->assertEquals('canceled', $scheduled_change
->getValue());
$this
->assertNotEmpty($scheduled_change
->getCreatedTime());
$this
->assertEquals($scheduled_change, $scheduled_change_item_list
->getScheduledChanges()[0]);
}