function CtoolsExportCrudTestCase::testCrudExportSetStatus

Tests CRUD operation: Set status.

File

tests/ctools_export_test/ctools_export.test, line 175

Class

CtoolsExportCrudTestCase
Tests for the CTools export system.

Code

public function testCrudExportSetStatus() {
    // Database only object.
    $database_export = ctools_export_crud_load('ctools_export_test', 'database_test');
    ctools_export_crud_disable('ctools_export_test', $database_export);
    ctools_export_load_object_reset('ctools_export_test');
    $disabled_export = ctools_export_crud_load('ctools_export_test', 'database_test');
    $this->assertTrue($disabled_export->disabled, 'The database only exportable has been disabled.');
    ctools_export_crud_enable('ctools_export_test', $disabled_export);
    ctools_export_load_object_reset('ctools_export_test');
    $enabled_export = ctools_export_crud_load('ctools_export_test', 'database_test');
    $this->assertTrue(empty($enabled_export->disabled), 'The database only exportable has been enabled.');
    // Overridden object.
    $overridden_export = ctools_export_crud_load('ctools_export_test', 'overridden_test');
    ctools_export_crud_disable('ctools_export_test', $overridden_export);
    ctools_export_load_object_reset('ctools_export_test');
    $disabled_export = ctools_export_crud_load('ctools_export_test', 'overridden_test');
    $this->assertTrue($disabled_export->disabled, 'The overridden exportable has been disabled.');
    ctools_export_crud_enable('ctools_export_test', $disabled_export);
    ctools_export_load_object_reset('ctools_export_test');
    $enabled_export = ctools_export_crud_load('ctools_export_test', 'overridden_test');
    $this->assertTrue(empty($enabled_export->disabled), 'The overridden exportable has been enabled.');
    // Default object.
    $default_export = ctools_export_crud_load('ctools_export_test', 'default_test');
    ctools_export_crud_disable('ctools_export_test', $default_export);
    ctools_export_load_object_reset('ctools_export_test');
    $disabled_export = ctools_export_crud_load('ctools_export_test', 'default_test');
    $this->assertTrue($disabled_export->disabled, 'The default exportable has been disabled.');
    ctools_export_crud_enable('ctools_export_test', $disabled_export);
    ctools_export_load_object_reset('ctools_export_test');
    $enabled_export = ctools_export_crud_load('ctools_export_test', 'default_test');
    $this->assertTrue(empty($enabled_export->disabled), 'The default exportable has been enabled.');
}