AnnounceFetcher example

'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');
  }

  /** * Test the ValidateUrl() method. * * @covers \Drupal\announcements_feed\AnnounceFetcher::validateUrl * * @dataProvider urlProvider */
  public function testValidateUrl($url$isValid) {
    $this->assertEquals($isValid$this->fetcher->validateUrl($url));
  }
Home | Imprint | This part of the site doesn't use cookies.