Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/next
  • issue/next-3343146
  • issue/next-3408097
  • issue/next-3437734
  • issue/next-3463748
  • issue/next-3488932
6 results
Show changes
Commits on Source (2)
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
......@@ -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);
......
<?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']);
}
}