public function CronJobKernelTest::testCRUD in Ultimate Cron 8.2
Tests CRUD operations for cron jobs.
File
- tests/
src/ Kernel/ CronJobKernelTest.php, line 34
Class
- CronJobKernelTest
- Tests CRUD for cron jobs.
Namespace
Drupal\Tests\ultimate_cron\KernelCode
public function testCRUD() {
$values = array(
'id' => 'example',
'title' => $this
->randomMachineName(),
'description' => $this
->randomMachineName(),
);
/** @var \Drupal\ultimate_cron\Entity\CronJob $cron_job */
$cron_job = CronJob::create($values);
$cron_job
->save();
$this
->assertEquals('example', $cron_job
->id());
$this
->assertEquals($values['title'], $cron_job
->label());
$this
->assertTrue($cron_job
->status());
$cron_job
->disable();
$cron_job
->save();
$cron_job = CronJob::load('example');
$this
->assertEquals('example', $cron_job
->id());
$this
->assertFalse($cron_job
->status());
}