Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eloqua_api_redux
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
eloqua_api_redux
Commits
c782debf
Commit
c782debf
authored
2 years ago
by
Project Update Bot
Committed by
Will Hartmann
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3287166
(mostly) by Project Update Bot: Automated Drupal 10 compatibility fixes
parent
3df4ed3b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
eloqua_api_redux.info.yml
+1
-1
1 addition, 1 deletion
eloqua_api_redux.info.yml
src/Service/EloquaApiClient.php
+2
-2
2 additions, 2 deletions
src/Service/EloquaApiClient.php
tests/src/Unit/EloquaApiClientTest.php
+12
-37
12 additions, 37 deletions
tests/src/Unit/EloquaApiClientTest.php
with
15 additions
and
40 deletions
eloqua_api_redux.info.yml
+
1
−
1
View file @
c782debf
...
...
@@ -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
This diff is collapsed.
Click to expand it.
src/Service/EloquaApiClient.php
+
2
−
2
View file @
c782debf
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
tests/src/Unit/EloquaApiClientTest.php
+
12
−
37
View file @
c782debf
...
...
@@ -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'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment