EntityTestBase.php in Drupal 10
File
core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
View source
<?php
namespace Drupal\Tests\migrate\Unit\Plugin\migrate\destination;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
class EntityTestBase extends UnitTestCase {
protected $migration;
protected $storage;
protected $entityType;
protected $entityFieldManager;
protected function setUp() : void {
parent::setUp();
$this->migration = $this
->prophesize(MigrationInterface::class);
$this->storage = $this
->prophesize(EntityStorageInterface::class);
$this->entityType = $this
->prophesize(EntityTypeInterface::class);
$this->entityType
->getPluralLabel()
->willReturn('foo');
$this->storage
->getEntityType()
->willReturn($this->entityType
->reveal());
$this->storage
->getEntityTypeId()
->willReturn('foo');
$this->entityFieldManager = $this
->prophesize(EntityFieldManagerInterface::class);
}
}
class BaseFieldDefinitionTest extends BaseFieldDefinition {
public static function create($type) {
return new static([]);
}
public function getSettings() {
return [];
}
public function getType() {
return 'integer';
}
}