ViewsRevisionableIntegrationTest.php in Entity Reference Hierarchy 3.x
File
tests/src/Kernel/ViewsRevisionableIntegrationTest.php
View source
<?php
namespace Drupal\Tests\entity_hierarchy\Kernel;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\entity_test\Entity\EntityTestRev;
class ViewsRevisionableIntegrationTest extends ViewsIntegrationTest {
const ENTITY_TYPE = 'entity_test_rev';
protected $testViewModule = 'entity_hierarchy_test_views_revision';
protected static $modules = [
'entity_hierarchy_test_views_revision',
];
protected function additionalSetup() {
$this
->installEntitySchema('entity_test');
parent::additionalSetup();
}
protected function doCreateTestEntity(array $values) {
$entity = EntityTestRev::create($values);
return $entity;
}
protected function createTestEntity($parentId, $label = 'Child 1', $weight = 0, $withRevision = TRUE) {
$entity = parent::createTestEntity($parentId, $label, $weight);
if ($withRevision) {
$entity
->setNewRevision(TRUE);
$entity
->save();
}
return $entity;
}
protected function doCreateChildTestEntity($parentId, $label, $weight) {
return $this
->createTestEntity($parentId, $label, $weight, FALSE);
}
protected function getArgumentFromEntity(ContentEntityInterface $entity) : int {
return $entity
->getRevisionId();
}
}