You are here

public function AssetCRUDTest::testViewAsset in farmOS 2.x

Display asset entity.

File

modules/core/asset/tests/src/Functional/AssetCRUDTest.php, line 61

Class

AssetCRUDTest
Tests the asset CRUD.

Namespace

Drupal\Tests\asset\Functional

Code

public function testViewAsset() {
  $edit = [
    'name' => $this
      ->randomMachineName(),
    'created' => \Drupal::time()
      ->getRequestTime(),
  ];
  $asset = $this
    ->createAssetEntity($edit);
  $asset
    ->save();
  $this
    ->drupalGet($asset
    ->toUrl('canonical'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertText($edit['name']);
  $this
    ->assertRaw(\Drupal::service('date.formatter')
    ->format(\Drupal::time()
    ->getRequestTime()));
}