public function FacetsDateHandlerTest::setUp in Facets 8
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Utility/ FacetsDateHandlerTest.php, line 43
Class
- FacetsDateHandlerTest
- Unit test for Date Handler Service.
Namespace
Drupal\Tests\facets\Unit\UtilityCode
public function setUp() {
parent::setUp();
$entity_storage = $this
->createMock(EntityStorageInterface::class);
$em = $this
->createMock(EntityTypeManagerInterface::class);
$em
->expects($this
->any())
->method('getStorage')
->with('date_format')
->willReturn($entity_storage);
$language = new Language([
'id' => 'en',
]);
$lm = $this
->createMock(LanguageManagerInterface::class);
$lm
->method('getCurrentLanguage')
->willReturn($language);
$st = $this
->createMock(TranslationInterface::class);
$rs = $this
->createMock(RequestStack::class);
$cf = $this
->getConfigFactoryStub();
$config_factory = $this
->getConfigFactoryStub([
'system.date' => [
'country' => [
'default' => 'GB',
],
],
]);
$container = new ContainerBuilder();
$container
->set('config.factory', $config_factory);
\Drupal::setContainer($container);
$date_formatter = new DateFormatter($em, $lm, $st, $cf, $rs);
$this->handler = new FacetsDateHandler($date_formatter);
}