Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setUpKeyValueEntityStorage example
\Drupal::
setContainer
(
$container
)
;
}
/** * @covers ::create * @covers ::doCreate */
public
function
testCreateWithPredefinedUuid
(
)
{
$this
->entityType->
expects
(
$this
->
once
(
)
)
->
method
(
'getClass'
)
->
willReturn
(
get_class
(
$this
->
getMockEntity
(
)
)
)
;
$this
->
setUpKeyValueEntityStorage
(
)
;
$this
->moduleHandler->
expects
(
$this
->
exactly
(
2
)
)
->
method
(
'invokeAll'
)
->
withConsecutive
(
[
'test_entity_type_create'
]
,
[
'entity_create'
]
)
;
$this
->uuidService->
expects
(
$this
->
never
(
)
)
->
method
(
'generate'
)
;
$entity
=
$this
->entityStorage->
create
(
[
'id' => 'foo', 'uuid' => 'baz'
]
)
;
$this
->
assertInstanceOf
(
'Drupal\Core\Entity\EntityInterface',
$entity
)
;
$this
->
assertSame
(
'foo',
$entity
->
id
(
)
)
;
$this
->
assertSame
(
'baz',
$entity
->
uuid
(
)
)
;
}