function AnnounceFetcherUnitTest::setUp

Same name in other branches
  1. 11.x core/modules/announcements_feed/tests/src/Unit/AnnounceFetcherUnitTest.php \Drupal\Tests\announcements_feed\Unit\AnnounceFetcherUnitTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/announcements_feed/tests/src/Unit/AnnounceFetcherUnitTest.php, line 27

Class

AnnounceFetcherUnitTest
Simple test to ensure that asserts pass.

Namespace

Drupal\Tests\announcements_feed\Unit

Code

public function setUp() : void {
    parent::setUp();
    $httpClient = $this->createMock('GuzzleHttp\\ClientInterface');
    $config = $this->getConfigFactoryStub([
        'announcements_feed.settings' => [
            'max_age' => 86400,
            'cron_interval' => 21600,
            'limit' => 10,
        ],
    ]);
    $tempStore = $this->createMock('Drupal\\Core\\KeyValueStore\\KeyValueExpirableFactoryInterface');
    $tempStore->expects($this->once())
        ->method('get')
        ->willReturn($this->createMock('Drupal\\Core\\KeyValueStore\\KeyValueStoreExpirableInterface'));
    $logger = $this->createMock('Psr\\Log\\LoggerInterface');
    $this->fetcher = new AnnounceFetcher($httpClient, $config, $tempStore, $logger, 'https://www.drupal.org/announcements.json');
}

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