public function PlanCRUDTest::testArchivePlanViaTimestamp in farmOS 2.x
Plan archiving/unarchiving via timestamp.
File
- modules/
core/ plan/ tests/ src/ Functional/ PlanCRUDTest.php, line 142
Class
- PlanCRUDTest
- Tests the plan CRUD.
Namespace
Drupal\Tests\plan\FunctionalCode
public function testArchivePlanViaTimestamp() {
$plan = $this
->createPlanEntity();
$plan
->save();
$this
->assertEquals($plan
->get('status')
->first()
->getString(), 'active', 'New plans are active by default');
$this
->assertNull($plan
->getArchivedTime(), 'Archived timestamp is null by default');
$plan
->setArchivedTime('2021-07-17T19:45:49+00:00');
$plan
->save();
$this
->assertEquals($plan
->get('status')
->first()
->getString(), 'archived', 'Plans can be archived');
$this
->assertEquals($plan
->getArchivedTime(), '2021-07-17T19:45:49+00:00', 'Archived timestamp is saved');
$plan
->setArchivedTime(NULL);
$plan
->save();
$this
->assertEquals($plan
->get('status')
->first()
->getString(), 'active', 'Plans can be made active');
$this
->assertNull($plan
->getArchivedTime(), 'Plan made active has a null timestamp');
}