24 private $metadataPoolMock;
29 private $resourceConnectionMock;
34 private $entityMetadataMock;
39 private $connectionMock;
48 $this->metadataPoolMock = $this->createMock(\
Magento\Framework\EntityManager\MetadataPool::class);
49 $this->resourceConnectionMock = $this->createMock(\
Magento\Framework\
App\ResourceConnection::class);
50 $this->entityMetadataMock = $this->createMock(\
Magento\Framework\EntityManager\EntityMetadataInterface::class);
51 $this->connectionMock = $this->createMock(\
Magento\Framework\DB\Adapter\AdapterInterface::class);
52 $this->selectMock = $this->createMock(\
Magento\Framework\DB\Select::class);
54 $this->metadataPoolMock,
55 $this->resourceConnectionMock
67 $data = [
'uuid' =>
'bulk-1'];
68 $connectionName =
'connection_name';
70 $this->metadataPoolMock
71 ->expects($this->once())
72 ->method(
'getMetadata')
74 ->willReturn($this->entityMetadataMock);
75 $this->entityMetadataMock
76 ->expects($this->once())
77 ->method(
'getEntityConnectionName')
78 ->willReturn($connectionName);
80 $this->resourceConnectionMock
81 ->expects($this->once())
82 ->method(
'getConnectionByName')
83 ->with($connectionName)
84 ->willReturn($this->connectionMock);
85 $this->connectionMock->expects($this->once())->method(
'select')->willReturn($this->selectMock);
86 $this->entityMetadataMock->expects($this->once())->method(
'getEntityTable')->willReturn(
$entityTable);
87 $this->selectMock->expects($this->once())->method(
'from')->with(
$entityTable,
'id')->willReturnSelf();
88 $this->selectMock->expects($this->once())->method(
'where')->with(
"uuid = ?",
'bulk-1')->willReturnSelf();
90 ->expects($this->once())
92 ->with($this->selectMock)
93 ->willReturn($identifier);
104 [1, [
'uuid' =>
'bulk-1',
'id' => 1]],
105 [
false, [
'uuid' =>
'bulk-1']]
entityToDatabaseDataProvider()
testEntityToDatabase($identifier, $result)