function AggregatorPluginSettingsBaseTest::setUp

Same name in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php \Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php, line 42

Class

AggregatorPluginSettingsBaseTest
Tests settings configuration of individual aggregator plugins.

Namespace

Drupal\Tests\aggregator\Unit\Plugin

Code

protected function setUp() : void {
    $this->configFactory = $this->getConfigFactoryStub([
        'aggregator.settings' => [
            'processors' => [
                'aggregator_test',
            ],
        ],
        'aggregator_test.settings' => [],
    ]);
    foreach ([
        'fetcher',
        'parser',
        'processor',
    ] as $type) {
        $this->managers[$type] = $this->getMockBuilder('Drupal\\aggregator\\Plugin\\AggregatorPluginManager')
            ->disableOriginalConstructor()
            ->getMock();
        $this->managers[$type]
            ->expects($this->once())
            ->method('getDefinitions')
            ->willReturn([
            'aggregator_test' => [
                'title' => '',
                'description' => '',
            ],
        ]);
    }
    
    /** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit\Framework\MockObject\MockBuilder $messenger */
    $messenger = $this->createMock(MessengerInterface::class);
    $messenger->expects($this->any())
        ->method('addMessage');
    $this->settingsForm = new SettingsForm($this->configFactory, $this->managers['fetcher'], $this->managers['parser'], $this->managers['processor'], $this->getStringTranslationStub());
    $this->settingsForm
        ->setMessenger($messenger);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.