public function PaymentStorageSchemaTest::setUp in Payment 8.2
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Entity/ Payment/ PaymentStorageSchemaTest.php, line 75
Class
- PaymentStorageSchemaTest
- @coversDefaultClass \Drupal\payment\Entity\Payment\PaymentStorageSchema
Namespace
Drupal\Tests\payment\Unit\Entity\PaymentCode
public function setUp() : void {
$entity_type_id_key = $this
->randomMachineName();
$entity_type_id = $this
->randomMachineName();
$this->database = $this
->getMockBuilder(Connection::class)
->disableOriginalConstructor()
->getMock();
$this->fieldStorageDefinitions = array(
$entity_type_id_key => $this
->createMock(FieldDefinitionInterface::class),
);
$this->entityTypeManager = $this
->getMockBuilder(EntityTypeManager::class)
->disableOriginalConstructor()
->getMock();
$this->entityFieldManager = $this
->getMockBuilder(EntityFieldManager::class)
->disableOriginalConstructor()
->getMock();
$this->entityFieldManager
->expects($this
->atLeastOnce())
->method('getActiveFieldStorageDefinitions')
->with($entity_type_id)
->willReturn($this->fieldStorageDefinitions);
$this->entityType = $this
->createMock(ContentEntityTypeInterface::class);
$this->entityType
->expects($this
->atLeastOnce())
->method('id')
->willReturn($entity_type_id);
$this->entityTypeManager
->expects($this
->atLeastOnce())
->method('getActiveDefinition')
->with($entity_type_id)
->willReturn($this->entityType);
$this->storage = $this
->getMockBuilder(SqlContentEntityStorage::class)
->disableOriginalConstructor()
->getMock();
$this->sut = new PaymentStorageSchema($this->entityTypeManager, $this->entityType, $this->storage, $this->database, $this->entityFieldManager);
}