Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
next
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
next
Compare revisions
1.3.1 to 1.4.0
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
project/next
Select target project
No results found
1.4.0
Select Git revision
Swap
Target
project/next
Select target project
project/next
issue/next-3343146
issue/next-3408097
issue/next-3437734
issue/next-3463748
issue/next-3488932
6 results
1.3.1
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Merge pull request
#352
from chapter-three/fix/resource-version
· 810f19a4
shadcn
authored
2 years ago
fix(next): no resourceVersion in query if not versionable
810f19a4
feat(next): add next_graphql module
· 3d11139f
shadcn
authored
2 years ago
3d11139f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/next_graphql/next_graphql.info.yml
+9
-0
9 additions, 0 deletions
modules/next_graphql/next_graphql.info.yml
src/Entity/NextSite.php
+3
-1
3 additions, 1 deletion
src/Entity/NextSite.php
tests/src/Kernel/Entity/NextSiteTest.php
+82
-0
82 additions, 0 deletions
tests/src/Kernel/Entity/NextSiteTest.php
with
94 additions
and
1 deletion
modules/next_graphql/next_graphql.info.yml
0 → 100644
View file @
3d11139f
name
:
"
Next.js
GraphQL"
type
:
module
description
:
"
GraphQL
for
Next.js"
core_version_requirement
:
^9
package
:
Web services
dependencies
:
-
graphql:graphql
-
graphql_compose:graphql_compose
-
next:next
This diff is collapsed.
Click to expand it.
src/Entity/NextSite.php
View file @
3d11139f
...
...
@@ -194,7 +194,9 @@ class NextSite extends ConfigEntityBase implements NextSiteInterface {
->
getId
();
}
$query
[
'resourceVersion'
]
=
$resource_version
;
if
(
$resource_version
)
{
$query
[
'resourceVersion'
]
=
$resource_version
;
}
$preview_url
->
setOption
(
'query'
,
$query
);
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/Entity/NextSiteTest.php
0 → 100644
View file @
3d11139f
<?php
namespace
Drupal\Tests\next\Kernel\Entity
;
use
Drupal\Component\Serialization\Json
;
use
Drupal\KernelTests\KernelTestBase
;
use
Drupal\next\Controller\NextPreviewUrlController
;
use
Drupal\next\Entity\NextSite
;
use
Drupal\Tests\node\Traits\NodeCreationTrait
;
use
Drupal\Tests\user\Traits\UserCreationTrait
;
use
Drupal\user\Entity\User
;
use
Symfony\Component\HttpFoundation\Request
;
/**
* Tests the NextSite entity.
*
* @coversDefaultClass \Drupal\next\Entity\NextSite
*
* @group next
*/
class
NextSiteTest
extends
KernelTestBase
{
use
NodeCreationTrait
,
UserCreationTrait
;
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'filter'
,
'next'
,
'node'
,
'system'
,
'user'
];
/**
* The next_site entity.
*
* @var \Drupal\next\Entity\NextSiteInterface
*/
protected
$nextSite
;
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
installEntitySchema
(
'node'
);
$this
->
installEntitySchema
(
'user'
);
$this
->
installConfig
([
'filter'
,
'next'
]);
$this
->
installSchema
(
'system'
,
[
'sequences'
]);
$this
->
installSchema
(
'node'
,
[
'node_access'
]);
$this
->
nextSite
=
NextSite
::
create
([
'label'
=>
'Blog'
,
'id'
=>
'blog'
,
'base_url'
=>
'https://blog.com'
,
'preview_url'
=>
'https://blog.com/api/preview'
,
'preview_secret'
=>
'one'
]);
$this
->
nextSite
->
save
();
$this
->
setUpCurrentUser
();
}
/**
* @covers ::getPreviewUrlForEntity
*/
public
function
testGetPreviewUrlForEntity
()
{
$user
=
$this
->
createUser
([
'access content'
]);
$this
->
setCurrentUser
(
$user
);
// User entity type is not versionable.
// No resourceVersion in the query.
$preview_url
=
$this
->
nextSite
->
getPreviewUrlForEntity
(
User
::
load
(
1
));
$query
=
$preview_url
->
getOption
(
'query'
);
$this
->
assertNotContains
(
'resourceVersion'
,
array_keys
(
$query
));
// Node entity type is versionable.
// Expect a resourceVersion.
$node
=
$this
->
createNode
();
$preview_url
=
$this
->
nextSite
->
getPreviewUrlForEntity
(
$node
);
$query
=
$preview_url
->
getOption
(
'query'
);
$this
->
assertSame
(
'rel:latest-version'
,
$query
[
'resourceVersion'
]);
}
}
This diff is collapsed.
Click to expand it.