MissingIdTest.php in Acquia Content Hub 8.2
File
tests/src/Kernel/MissingIdTest.php
View source
<?php
namespace Drupal\Tests\acquia_contenthub\Kernel;
use Drupal\webform\Entity\Webform;
use Drupal\webform\Entity\WebformSubmission;
class MissingIdTest extends QueueingTestBase {
public static $modules = [
'webform',
];
protected function setUp() : void {
parent::setUp();
$this
->installSchema('webform', [
'webform',
]);
$this
->installConfig('webform');
$this
->installEntitySchema('webform_submission');
}
public function testMissingId() {
$webform = Webform::create([
'id' => $this
->randomMachineName(),
]);
$elements = [
'name' => [
'#type' => 'textfield',
'#title' => 'name',
],
];
$webform
->setElements($elements);
$webform
->setSetting('results_disabled', TRUE);
$webform
->save();
$pre_webform_submission_queue_count = $this->contentHubQueue
->getQueueCount();
$webform_submission = WebformSubmission::create([
'id' => $this
->randomMachineName(),
'webform_id' => $webform
->id(),
'data' => [
'name' => $this
->randomMachineName(),
],
]);
$webform_submission
->save();
$this
->assertEqual($this->contentHubQueue
->getQueueCount(), $pre_webform_submission_queue_count, 'Webform submission not queued.');
}
}
Classes
Name |
Description |
MissingIdTest |
Tests that entities without ids are not eligible for export. |