diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewsHooksTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewsHooksTest.php index aa0bc6c..d9d2489 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewsHooksTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewsHooksTest.php @@ -45,19 +45,12 @@ class ViewsHooksTest extends ViewUnitTestBase { ); /** - * The moduel handler to use for invoking hooks. + * The module handler to use for invoking hooks. * * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; - /** - * A test view executable to use for testing. - * - * @var \Drupal\views\ViewEexecutable - */ - protected $testView; - public static function getInfo() { return array( 'name' => 'Views hooks', @@ -66,29 +59,32 @@ public static function getInfo() { ); } - public function setUp() { + protected function setUp() { parent::setUp(); $this->moduleHandler = $this->container->get('module_handler'); - $this->testView = views_get_view('test_view'); } /** * Tests the hooks. */ public function testHooks() { + $view = views_get_view('test_view'); + // Test each hook is found in the implementations array and is invoked. foreach (static::$hooks as $hook => $type) { $this->assertTrue($this->moduleHandler->implementsHook('views_test_data', $hook), format_string('The hook @hook was registered.', array('@hook' => $hook))); switch ($type) { case 'view': - $this->moduleHandler->invoke('views_test_data', $hook, array($this->testView)); - break; + $this->moduleHandler->invoke('views_test_data', $hook, array($view)); + break; + case 'alter': $data = array(); $this->moduleHandler->invoke('views_test_data', $hook, array($data)); - break; + break; + default: $this->moduleHandler->invoke('views_test_data', $hook); }