Skip to content
Snippets Groups Projects
Commit c782debf authored by Project Update Bot's avatar Project Update Bot Committed by Will Hartmann
Browse files

Issue #3287166 (mostly) by Project Update Bot: Automated Drupal 10 compatibility fixes

parent 3df4ed3b
Branches
Tags
No related merge requests found
......@@ -3,5 +3,5 @@ description: Integrate Drupal 8 modules with Eloqua REST API.
type: module
package: Eloqua
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.9 || ^9 || ^10
configure: eloqua_api_redux.settings
......@@ -327,7 +327,7 @@ class EloquaApiClient {
// Save the token.
$cacheItem = [
'value' => $value,
'expire' => REQUEST_TIME + $this->eloquaApiCacheAge($key),
'expire' => \Drupal::time()->getRequestTime() + $this->eloquaApiCacheAge($key),
];
$this->configTokens
......@@ -349,7 +349,7 @@ class EloquaApiClient {
if ($cache = $this->configTokens->get($type)) {
$response = unserialize($cache, ['allowed_classes' => FALSE]);
$now = REQUEST_TIME;
$now = \Drupal::time()->getRequestTime();
$expire = $response['expire'];
// Manually validate if the token is still fresh.
......
......@@ -76,21 +76,14 @@ class EloquaApiClientTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->httpClientFactory = $this->getMockBuilder('Drupal\Core\Http\ClientFactory')
->disableOriginalConstructor()
->getMock();
$this->httpClientFactory = $this->createMock('Drupal\Core\Http\ClientFactory');
$this->config = $this->getMockBuilder('Drupal\Core\Config\Config\Drupal\Core\Config\ImmutableConfig')
->disableOriginalConstructor()
->setMethods(['get'])
->getMock();
$this->config = $this->createMock('Drupal\Core\Config\ImmutableConfig');
$this->configFactory = $this->getMockBuilder('Drupal\Core\Config\ConfigFactory')
->disableOriginalConstructor()
->getMock();
$this->configFactory = $this->createMock('Drupal\Core\Config\ConfigFactory');
$this->configFactory->expects($this->any())
->method('get')
......@@ -102,29 +95,17 @@ class EloquaApiClientTest extends UnitTestCase {
->with('eloqua_api_redux.tokens')
->will($this->returnValue($this->configTokens));
$this->loggerFactory = $this->getMockBuilder('Drupal\Core\Logger\LoggerChannelFactoryInterface')
->disableOriginalConstructor()
->getMock();
$this->loggerFactory = $this->createMock('Drupal\Core\Logger\LoggerChannelFactoryInterface');
$this->cacheBackend = $this->getMockBuilder('Drupal\Core\Cache\CacheBackendInterface')
->disableOriginalConstructor()
->getMock();
$this->cacheBackend = $this->createMock('Drupal\Core\Cache\CacheBackendInterface');
$this->moduleHandler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandlerInterface')
->disableOriginalConstructor()
->getMock();
$this->moduleHandler = $this->createMock('Drupal\Core\Extension\ModuleHandlerInterface');
// Set container and required dependencies.
$container = new ContainerBuilder();
$pathValidator = $this->getMockBuilder('Drupal\Core\Path\PathValidatorInterface')
->disableOriginalConstructor()
->getMock();
$unroutedUrlAssembler = $this->getMockBuilder('Drupal\Core\Utility\UnroutedUrlAssemblerInterface')
->disableOriginalConstructor()
->getMock();
$authFallbackService = $this->getMockBuilder('Drupal\eloqua_api_redux\Service\EloquaAuthFallbackInterface')
->disableOriginalConstructor()
->getMock();
$pathValidator = $this->createMock('Drupal\Core\Path\PathValidatorInterface');
$unroutedUrlAssembler = $this->createMock('Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
$authFallbackService = $this->createMock('Drupal\eloqua_api_redux\Service\EloquaAuthFallbackInterface');
$container->set('path.validator', $pathValidator);
$container->set('unrouted_url_assembler', $unroutedUrlAssembler);
$container->set('eloqua_api_redux.auth_fallback_default', $authFallbackService);
......@@ -221,15 +202,9 @@ class EloquaApiClientTest extends UnitTestCase {
$this->getMockResponseContents(self::ACCESS_TOKEN_RESPONSE)
);
$httpClientFactory = $this->getMockBuilder('Drupal\Core\Http\ClientFactory')
->disableOriginalConstructor()
->setMethods(['fromOptions'])
->getMock();
$httpClientFactory = $this->createMock('Drupal\Core\Http\ClientFactory');
$guzzleClient = $this->getMockBuilder('GuzzleHttp\Client')
->disableOriginalConstructor()
->setMethods(['request'])
->getMock();
$guzzleClient = $this->createMock('GuzzleHttp\Client');
$guzzleClient->expects($this->any())
->method('request')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment