$this->
assertEquals(1,
$entity->postCreateCount
);
// Verify that none of the other methods have been invoked.
$this->
assertEquals(0, EntityTestBundleClass::
$preDeleteCount);
$this->
assertEquals(0, EntityTestBundleClass::
$postDeleteCount);
$this->
assertEquals(0, EntityTestBundleClass::
$postLoadCount);
$this->
assertCount(0, EntityTestBundleClass::
$postLoadEntitiesCount);
// Verify statically created entity with bundle class returns correct
// bundle.
$entity = EntityTestBundleClass::
create(['type' => 'custom'
]);
$this->
assertInstanceOf(EntityTestBundleClass::
class,
$entity);
$this->
assertEquals('bundle_class',
$entity->
bundle());
// We should have seen preCreate() a 2nd time.
$this->
assertEquals(2, EntityTestBundleClass::
$preCreateCount);
// postCreate() is specific to each entity instance, so still 1.
$this->
assertEquals(1,
$entity->postCreateCount
);
// Verify that none of the other methods have been invoked.
$this->
assertEquals(0, EntityTestBundleClass::
$preDeleteCount);
$this->
assertEquals(0, EntityTestBundleClass::
$postDeleteCount);
$this->
assertEquals(0, EntityTestBundleClass::
$postLoadCount);
$this->
assertCount(0, EntityTestBundleClass::
$postLoadEntitiesCount);