function EntityUriTest::testDefaultUri

Tests that an entity without a URI callback uses the default URI.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUriTest.php, line 31
Contains \Drupal\system\Tests\Entity\EntityUriTest.

Class

EntityUriTest
Tests the basic Entity API.

Namespace

Drupal\system\Tests\Entity

Code

function testDefaultUri() {

  // Create a test entity.
  $entity = entity_create('entity_test', array(
    'name' => 'test',
    'user_id' => 1,
  ));
  $entity
    ->save();
  $uri = $entity
    ->uri();
  $expected_path = 'entity/entity_test/' . $entity
    ->id();
  $this
    ->assertEqual(url($uri['path'], $uri['options']), url($expected_path), 'Entity without URI callback returns expected URI.');
}