AggregatorPluginManagerTest.php 1.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

namespace Drupal\Tests\aggregator\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
 * Tests the aggregator plugin manager.
 *
 * @group aggregator
 */
class AggregatorPluginManagerTest extends KernelTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
19
  protected static $modules = ['aggregator', 'aggregator_test'];
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

  /**
   * Tests that the fetcher info alter hook works.
   */
  public function testFetcherInfoAlter() {
    $widget_definition = \Drupal::service('plugin.manager.aggregator.fetcher')->getDefinition('aggregator_test_fetcher');

    // Test if hook_aggregator_fetcher_info_alter is being called.
    $this->assertTrue($widget_definition['definition_altered'], "The 'aggregator_test_fetcher' plugin definition was updated in `hook_aggregator_fetcher_info_alter()`");
  }

  /**
   * Tests that the fetcher info alter hook works.
   */
  public function testParserInfoAlter() {
    $widget_definition = \Drupal::service('plugin.manager.aggregator.parser')->getDefinition('aggregator_test_parser');

    // Test if hook_aggregator_parser_info_alter is being called.
38
    $this->assertTrue($widget_definition['definition_altered'], "The 'aggregator_test_parser' plugin definition was updated in `hook_aggregator_parser_info_alter()`");
39
40
41
42
43
44
45
46
47
  }

  /**
   * Tests that the fetcher info alter hook works.
   */
  public function testProcessorInfoAlter() {
    $widget_definition = \Drupal::service('plugin.manager.aggregator.processor')->getDefinition('aggregator_test_processor');

    // Test if hook_aggregator_processor_info_alter is being called.
48
    $this->assertTrue($widget_definition['definition_altered'], "The 'aggregator_test_processor' plugin definition was updated in `hook_aggregator_processor_info_alter()`");
49
50
51
  }

}