function ViewsViewTest::assertViewDestroy

Assert that a given view is destroyed properly.

Parameters

object $view: The view to destroy.

1 call to ViewsViewTest::assertViewDestroy()
ViewsViewTest::testDestroy in tests/views_view.test
Ensure that every kind of heavy objects are removed by the destructor.

File

tests/views_view.test, line 49

Class

ViewsViewTest

Code

public function assertViewDestroy($view) {
    $this->assertFalse(isset($view->display['default']->handler), 'Make sure all displays are destroyed.');
    $this->assertFalse(isset($view->display['attachment_1']->handler), 'Make sure all displays are destroyed.');
    $this->assertFalse(isset($view->filter), 'Make sure all handlers are destroyed');
    $this->assertFalse(isset($view->field), 'Make sure all handlers are destroyed');
    $this->assertFalse(isset($view->argument), 'Make sure all handlers are destroyed');
    $this->assertFalse(isset($view->relationship), 'Make sure all handlers are destroyed');
    $this->assertFalse(isset($view->sort), 'Make sure all handlers are destroyed');
    $this->assertFalse(isset($view->area), 'Make sure all handlers are destroyed');
    $keys = array(
        'current_display',
        'display_handler',
        'field',
        'argument',
        'filter',
        'sort',
        'relationship',
        'header',
        'footer',
        'empty',
        'query',
        'result',
        'inited',
        'style_plugin',
        'plugin_name',
        'exposed_data',
        'exposed_input',
        'many_to_one_tables',
    );
    foreach ($keys as $key) {
        $this->assertFalse(isset($view->{$key}), $key);
    }
    $this->assertEqual($view->built, FALSE);
    $this->assertEqual($view->executed, FALSE);
    $this->assertEqual($view->build_info, array());
    $this->assertEqual($view->attachment_before, '');
    $this->assertEqual($view->attachment_after, '');
}