$methods =
array_merge($methods,
['getEntityType', 'entityTypeBundleInfo'
]);
// Prophecy does not allow prophesizing abstract classes while actually
// calling their code. We use Prophecy below because that allows us to
// add method prophecies later while still revealing the prophecy now.
$entity =
$this->
getMockBuilder($class) ->
setConstructorArgs([$values,
$this->entityTypeId
]) ->
onlyMethods($methods) ->
getMockForAbstractClass();
$this->entityType =
$this->
prophesize(EntityTypeInterface::
class);
$this->entityType->
getLinkTemplates()->
willReturn([]);
$this->entityType->
getKey('langcode'
)->
willReturn(FALSE
);
$entity->
method('getEntityType'
)->
willReturn($this->entityType->
reveal());
$this->entityTypeBundleInfo =
$this->
prophesize(EntityTypeBundleInfoInterface::
class);
$entity->
method('entityTypeBundleInfo'
)->
willReturn($this->entityTypeBundleInfo->
reveal());
return $entity;
} /**
* Asserts that a given URL object matches the expectations.
*
* @param string $expected_route_name
* The expected route name of the generated URL.
* @param array $expected_route_parameters
* The expected route parameters of the generated URL.
* @param \Drupal\Tests\Core\Entity\UrlTestEntity|\PHPUnit\Framework\MockObject\MockObject $entity
* The entity that is expected to be set as a URL option.
* @param bool $has_language
* Whether or not the URL is expected to have a language option.
* @param \Drupal\Core\Url $url
* The URL option to make the assertions on.
*
* @internal
*/