You are here

function ViewExecutableTest::assertViewDestroy in Views (for Drupal 7) 8.3

1 call to ViewExecutableTest::assertViewDestroy()
ViewExecutableTest::testDestroy in lib/Drupal/views/Tests/ViewExecutableTest.php
Tests the deconstructor to be sure that every kind of heavy objects are removed.

File

lib/Drupal/views/Tests/ViewExecutableTest.php, line 174
Definition of Drupal\views\Tests\ViewExecutableTest.

Class

ViewExecutableTest
Tests the ViewExecutable class.

Namespace

Drupal\views\Tests

Code

function assertViewDestroy($view) {
  $this
    ->assertFalse(isset($view->displayHandlers['default']), 'Make sure all displays are destroyed.');
  $this
    ->assertFalse(isset($view->displayHandlers['attachment_1']), 'Make sure all displays are destroyed.');
  $this
    ->assertFalse(isset($view->filter), 'Make sure all filter handlers are destroyed');
  $this
    ->assertFalse(isset($view->field), 'Make sure all field handlers are destroyed');
  $this
    ->assertFalse(isset($view->argument), 'Make sure all argument handlers are destroyed');
  $this
    ->assertFalse(isset($view->relationship), 'Make sure all relationship handlers are destroyed');
  $this
    ->assertFalse(isset($view->sort), 'Make sure all sort handlers are destroyed');
  $this
    ->assertFalse(isset($view->area), 'Make sure all area 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, '');
}