You are here

public function AssetCRUDTest::testDeleteAsset in farmOS 2.x

Delete asset entity.

File

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

Class

AssetCRUDTest
Tests the asset CRUD.

Namespace

Drupal\Tests\asset\Functional

Code

public function testDeleteAsset() {
  $asset = $this
    ->createAssetEntity();
  $asset
    ->save();
  $label = $asset
    ->getName();
  $asset_id = $asset
    ->id();
  $this
    ->drupalPostForm($asset
    ->toUrl('delete-form'), [], $this
    ->t('Delete'));
  $this
    ->assertRaw($this
    ->t('The @entity-type %label has been deleted.', [
    '@entity-type' => $asset
      ->getEntityType()
      ->getSingularLabel(),
    '%label' => $label,
  ]));
  $this
    ->assertNull(Asset::load($asset_id));
}