You are here

public function CtoolsExportCrudTestCase::testCrudExportDelete in Chaos Tool Suite (ctools) 7

Tests CRUD operation: Delete.

File

tests/ctools_export_test/ctools_export.test, line 148

Class

CtoolsExportCrudTestCase
Tests for the CTools export system.

Code

public function testCrudExportDelete() {

  // Create a stub entry save it and delete it from the database.
  $new_export = ctools_export_crud_new('ctools_export_test');
  ctools_export_crud_save('ctools_export_test', $new_export);
  $machine = $new_export->machine;
  ctools_export_crud_delete('ctools_export_test', $new_export);
  $result = ctools_export_crud_load('ctools_export_test', $machine);
  $this
    ->assertFalse($result, 'The new exportable has been removed from the database.');

  // Load the database only exportable.
  $database_export = ctools_export_crud_load('ctools_export_test', 'database_test');
  $machine = $database_export->machine;
  ctools_export_crud_delete('ctools_export_test', $database_export);

  // Clear the exportable caches as it's been loaded above.
  ctools_export_load_object_reset('ctools_export_test');
  $result = ctools_export_crud_load('ctools_export_test', $machine);
  $this
    ->assertFalse($result, 'The database exportable has been removed from the database.');
}