protected function ProviderRepositoryTest::setUp in Drupal 9
Overrides UnitTestCase::setUp
File
- core/
modules/ media/ tests/ src/ Unit/ ProviderRepositoryTest.php, line 62
Class
- ProviderRepositoryTest
- @coversDefaultClass \Drupal\media\OEmbed\ProviderRepository
Namespace
Drupal\Tests\media\UnitCode
protected function setUp() : void {
parent::setUp();
$config_factory = $this
->getConfigFactoryStub([
'media.settings' => [
'oembed_providers_url' => 'https://oembed.com/providers.json',
],
]);
$key_value_factory = new KeyValueMemoryFactory();
$this->keyValue = $key_value_factory
->get('media');
$this->currentTime = time();
$time = $this
->prophesize('\\Drupal\\Component\\Datetime\\TimeInterface');
$time
->getCurrentTime()
->willReturn($this->currentTime);
$this->logger = $this
->prophesize('\\Psr\\Log\\LoggerInterface');
$logger_factory = new LoggerChannelFactory();
$logger_factory
->addLogger($this->logger
->reveal());
$this->responses = new MockHandler();
$client = new Client([
'handler' => HandlerStack::create($this->responses),
]);
$this->repository = new ProviderRepository($client, $config_factory, $time
->reveal(), $key_value_factory, $logger_factory);
}