Skip to content
Snippets Groups Projects
Commit 0f73e243 authored by dpi's avatar dpi
Browse files

:arrow_up: Issue #3288850 by dpi: Drupal 10 compatibility

parent a659b2ef
Branches
Tags
1 merge request!4⬆️ Issue #3288850 by dpi: Drupal 10 compatibility
......@@ -6,7 +6,7 @@ namespace Drupal\oh\Event;
use Drupal\Core\Entity\EntityInterface;
use Drupal\oh\OhDateRange;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to add events between a date range.
......
......@@ -7,7 +7,7 @@ namespace Drupal\oh\Event;
use Drupal\Core\Entity\EntityInterface;
use Drupal\oh\OhDateRange;
use Drupal\oh\OhOccurrence;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to add exceptions between a date range.
......
......@@ -6,7 +6,7 @@ namespace Drupal\oh\Event;
use Drupal\Core\Entity\EntityInterface;
use Drupal\oh\OhDateRange;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to process opening hours after they have been computed.
......
......@@ -7,7 +7,7 @@ namespace Drupal\oh\Event;
use Drupal\Core\Entity\EntityInterface;
use Drupal\oh\OhDateRange;
use Drupal\oh\OhOccurrence;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Used to add regular hours between a date range.
......
......@@ -40,7 +40,7 @@ class OhOpeningHours implements OhOpeningHoursInterface {
public function getOccurrences(EntityInterface $entity, OhDateRange $range): array {
$occurrences = $this->getDimensionalOccurrences($entity, $range);
$event = new OhProcessEvent($entity, $range, $occurrences);
$this->eventDispatcher->dispatch(OhEvents::PROCESS, $event);
$this->eventDispatcher->dispatch($event, OhEvents::PROCESS);
return $event->getOccurrences();
}
......@@ -80,7 +80,7 @@ class OhOpeningHours implements OhOpeningHoursInterface {
*/
public function getRegularHours(EntityInterface $entity, OhDateRange $range): array {
$event = new OhRegularEvent($entity, $range);
$this->eventDispatcher->dispatch(OhEvents::REGULAR, $event);
$this->eventDispatcher->dispatch($event, OhEvents::REGULAR);
return $event->getRegularHours();
}
......@@ -89,7 +89,7 @@ class OhOpeningHours implements OhOpeningHoursInterface {
*/
public function getExceptions(EntityInterface $entity, OhDateRange $range): array {
$event = new OhExceptionEvent($entity, $range);
$this->eventDispatcher->dispatch(OhEvents::EXCEPTIONS, $event);
$this->eventDispatcher->dispatch($event, OhEvents::EXCEPTIONS);
return $event->getExceptions();
}
......
......@@ -279,9 +279,7 @@ final class OhFlattenTest extends UnitTestCase {
* Tests occurrences are flattened and cacheability is retained.
*/
public function testCacheability(): void {
$cache_contexts_manager = $this->getMockBuilder(CacheContextsManager::class)
->disableOriginalConstructor()
->getMock();
$cache_contexts_manager = $this->createMock(CacheContextsManager::class);
$cache_contexts_manager->method('assertValidTokens')->willReturn(TRUE);
$container = new Container();
$container->set('cache_contexts_manager', $cache_contexts_manager);
......
......@@ -77,9 +77,7 @@ final class OhOccurrenceTest extends UnitTestCase {
* @covers ::getCacheMaxAge
*/
public function testCachability(): void {
$cacheContextsManager = $this->getMockBuilder(CacheContextsManager::class)
->disableOriginalConstructor()
->getMock();
$cacheContextsManager = $this->createMock(CacheContextsManager::class);
$cacheContextsManager->method('assertValidTokens')->willReturn(TRUE);
$container = new ContainerBuilder();
$container->set('cache_contexts_manager', $cacheContextsManager);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment