Commit c31fec26 authored by alexpott's avatar alexpott

Issue #2476059 by willzyx, tadityar, yarik.lutsiuk, Berdir: Remove...

Issue #2476059 by willzyx, tadityar, yarik.lutsiuk, Berdir: Remove EntityInterface->getSystemPath(), all its implementations and related usage
parent 99e07773
......@@ -392,13 +392,6 @@ public function urlInfo($rel = 'edit-form', array $options = []) {
return parent::urlInfo($rel, $options);
}
/**
* {@inheritdoc}
*/
public function getSystemPath($rel = 'edit-form') {
return parent::getSystemPath($rel);
}
/**
* {@inheritdoc}
*/
......
......@@ -216,16 +216,6 @@ public function urlInfo($rel = 'canonical', array $options = []) {
return $uri->setOptions($uri_options);
}
/**
* {@inheritdoc}
*/
public function getSystemPath($rel = 'canonical') {
if ($this->hasLinkTemplate($rel) && $uri = $this->urlInfo($rel)) {
return $uri->getInternalPath();
}
return '';
}
/**
* {@inheritdoc}
*/
......
......@@ -161,23 +161,6 @@ public function url($rel = 'canonical', $options = array());
*/
public function link($text = NULL, $rel = 'canonical', array $options = []);
/**
* Gets the internal path for this entity.
*
* self::url() will return the full path including any prefixes, fragments, or
* query strings. This path does not include those.
*
* @param string $rel
* The link relationship type, for example: canonical or edit-form.
*
* @return string
* The internal path for this entity.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.0. Use
* static::urlInfo() instead.
*/
public function getSystemPath($rel = 'canonical');
/**
* Indicates if a link template exists for a given key.
*
......
......@@ -138,12 +138,12 @@ protected function doTestPublishedStatus() {
*/
protected function doTestAuthoringInfo() {
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
$path = $entity->getSystemPath('edit-form');
$languages = $this->container->get('language_manager')->getLanguages();
$values = array();
// Post different authoring information for each translation.
foreach ($this->langcodes as $langcode) {
$url = $entity->urlInfo('edit-form', ['language' => $languages[$langcode]]);
$user = $this->drupalCreateUser();
$values[$langcode] = array(
'uid' => $user->id(),
......@@ -154,7 +154,7 @@ protected function doTestAuthoringInfo() {
'date[date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'),
'date[time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'),
);
$this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity, $langcode), array('language' => $languages[$langcode]));
$this->drupalPostForm($url, $edit, $this->getFormSubmitAction($entity, $langcode));
}
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
......
......@@ -996,13 +996,6 @@ public function link($text = NULL, $rel = 'edit-form', array $options = []) {
return $this->storage->link($text, $rel, $options);
}
/**
* {@inheritdoc}
*/
public function getSystemPath($rel = 'edit-form') {
return $this->storage->getSystemPath($rel);
}
/**
* Implements \Drupal\Core\Entity\EntityInterface::label().
*/
......
......@@ -239,38 +239,6 @@ public function testUrl() {
$this->assertSame('http://drupal/entity/test_entity_type/test_entity_id', $valid_entity->url('canonical', array('absolute' => TRUE)));
}
/**
* Tests the getPathByAlias() method.
*
* @covers ::getSystemPath
*/
public function testGetSystemPath() {
$entity_type = $this->getMock('Drupal\Core\Entity\EntityTypeInterface');
$entity_type->expects($this->any())
->method('getLinkTemplates')
->will($this->returnValue(array(
'canonical' => 'entity.test_entity_type.canonical',
)));
$this->entityManager
->expects($this->any())
->method('getDefinition')
->with('test_entity_type')
->will($this->returnValue($entity_type));
$no_link_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', array(array('id' => 'test_entity_id'), 'test_entity_type'));
$this->assertSame('', $no_link_entity->getSystemPath('banana'));
$this->urlGenerator->expects($this->once())
->method('getPathFromRoute')
->with('entity.test_entity_type.canonical', array('test_entity_type' => 'test_entity_id'))
->will($this->returnValue('entity/test_entity_type/test_entity_id'));
$valid_entity = $this->getMockForAbstractClass('Drupal\Core\Entity\Entity', array(array('id' => 'test_entity_id'), 'test_entity_type'));
$this->assertSame('entity/test_entity_type/test_entity_id', $valid_entity->getSystemPath());
}
/**
* Tests the retrieval of link templates.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment