contrib modules updates
This commit is contained in:
@@ -9,8 +9,8 @@ dependencies:
|
||||
- drupal:field
|
||||
- drupal:text
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-03-08
|
||||
version: '8.x-5.0-beta7'
|
||||
# Information added by Drupal.org packaging script on 2018-12-28
|
||||
version: '8.x-5.0-beta8'
|
||||
core: '8.x'
|
||||
project: 'linkit'
|
||||
datestamp: 1520552594
|
||||
datestamp: 1545966788
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\linkit\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\linkit\Tests\ProfileCreationTrait;
|
||||
|
||||
/**
|
||||
@@ -62,8 +61,8 @@ class ProfileAdminTest extends LinkitBrowserTestBase {
|
||||
|
||||
// Create a profile.
|
||||
$edit = [];
|
||||
$edit['label'] = Unicode::strtolower($this->randomMachineName());
|
||||
$edit['id'] = Unicode::strtolower($this->randomMachineName());
|
||||
$edit['label'] = mb_strtolower($this->randomMachineName());
|
||||
$edit['id'] = mb_strtolower($this->randomMachineName());
|
||||
$edit['description'] = $this->randomMachineName(16);
|
||||
$this->submitForm($edit, t('Save and manage matchers'));
|
||||
|
||||
|
||||
+24
-2
@@ -5,7 +5,6 @@ namespace Drupal\Tests\linkit\Kernel;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
use Drupal\entity_test\Entity\EntityTestMul;
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
@@ -153,6 +152,29 @@ class LinkitAutocompleteTest extends LinkitKernelTestBase {
|
||||
$this->assertEmpty(count($data), 'Autocomplete did not return any suggestions.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests autocompletion with results limit.
|
||||
*/
|
||||
public function testAutocompletionWithLimit() {
|
||||
/** @var \Drupal\linkit\MatcherInterface $plugin */
|
||||
$plugin = $this->matcherManager->createInstance('entity:entity_test');
|
||||
$configuration = $plugin->getConfiguration();
|
||||
$configuration['settings']['limit'] = 2;
|
||||
|
||||
$this->linkitProfile->addMatcher($configuration);
|
||||
$this->linkitProfile->save();
|
||||
|
||||
$entity_1 = EntityTest::create(['name' => 'foo 1']);
|
||||
$entity_1->save();
|
||||
$entity_2 = EntityTest::create(['name' => 'foo 2']);
|
||||
$entity_2->save();
|
||||
$entity_3 = EntityTest::create(['name' => 'foo 3']);
|
||||
$entity_3->save();
|
||||
|
||||
$data = $this->getAutocompleteResult('foo');
|
||||
$this->assertTrue(count($data) == 2, 'Autocomplete returned the expected amount of suggestions.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests autocompletion with translated entities.
|
||||
*/
|
||||
@@ -221,7 +243,7 @@ class LinkitAutocompleteTest extends LinkitKernelTestBase {
|
||||
protected function createProfile(array $settings = []) {
|
||||
// Populate defaults array.
|
||||
$settings += [
|
||||
'id' => Unicode::strtolower($this->randomMachineName()),
|
||||
'id' => mb_strtolower($this->randomMachineName()),
|
||||
'label' => $this->randomMachineName(),
|
||||
];
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class LinkitKernelTestBase extends KernelTestBase {
|
||||
if ($permissions) {
|
||||
// Create a new role and apply permissions to it.
|
||||
$role = Role::create([
|
||||
'id' => strtolower($this->randomMachineName(8)),
|
||||
'id' => mb_strtolower($this->randomMachineName(8)),
|
||||
'label' => $this->randomMachineName(8),
|
||||
]);
|
||||
$role->save();
|
||||
|
||||
+25
-2
@@ -18,7 +18,7 @@ class NodeMatcherTest extends LinkitKernelTestBase {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['field', 'node'];
|
||||
public static $modules = ['field', 'node', 'content_moderation', 'workflows'];
|
||||
|
||||
/**
|
||||
* The matcher manager.
|
||||
@@ -34,6 +34,7 @@ class NodeMatcherTest extends LinkitKernelTestBase {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('node');
|
||||
$this->installSchema('node', ['node_access']);
|
||||
$this->installConfig(['field', 'node']);
|
||||
|
||||
$this->manager = $this->container->get('plugin.manager.linkit.matcher');
|
||||
@@ -74,7 +75,7 @@ class NodeMatcherTest extends LinkitKernelTestBase {
|
||||
]);
|
||||
$node->save();
|
||||
|
||||
// Unpublished node.
|
||||
// Unpublished nodes.
|
||||
$node = Node::create([
|
||||
'title' => 'Lorem unpublishd',
|
||||
'type' => $type1->id(),
|
||||
@@ -82,6 +83,13 @@ class NodeMatcherTest extends LinkitKernelTestBase {
|
||||
]);
|
||||
$node->save();
|
||||
|
||||
$node = Node::create([
|
||||
'title' => 'Lorem unpublishd 2',
|
||||
'type' => $type2->id(),
|
||||
'status' => FALSE,
|
||||
]);
|
||||
$node->save();
|
||||
|
||||
// Set the current user to someone that is not the node owner.
|
||||
\Drupal::currentUser()->setAccount($this->createUser([], ['access content']));
|
||||
}
|
||||
@@ -133,7 +141,22 @@ class NodeMatcherTest extends LinkitKernelTestBase {
|
||||
|
||||
// Test with permissions to see unpublished nodes.
|
||||
$suggestions = $plugin->execute('Lorem');
|
||||
$this->assertEquals(5, count($suggestions->getSuggestions()), 'Correct number of suggestions');
|
||||
|
||||
// Test with permissions to see own unpublished nodes.
|
||||
\Drupal::currentUser()->setAccount($this->createUser([], ['access content', 'view own unpublished content']));
|
||||
$nodes = $this->container->get('entity_type.manager')->getStorage('node')->loadByProperties(['title' => 'Lorem unpublishd']);
|
||||
$node4 = reset($nodes);
|
||||
/** @var \Drupal\node\NodeInterface $node4 */
|
||||
$node4->setOwnerId(\Drupal::currentUser()->id());
|
||||
$node4->save();
|
||||
$suggestions = $plugin->execute('Lorem');
|
||||
$this->assertEquals(4, count($suggestions->getSuggestions()), 'Correct number of suggestions');
|
||||
|
||||
// Test with permissions to see any unpublished nodes.
|
||||
\Drupal::currentUser()->setAccount($this->createUser([], ['access content', 'view any unpublished content']));
|
||||
$suggestions = $plugin->execute('Lorem');
|
||||
$this->assertEquals(5, count($suggestions->getSuggestions()), 'Correct number of suggestions');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Drupal\Tests\linkit\Kernel\Matchers;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\taxonomy\VocabularyInterface;
|
||||
use Drupal\Tests\linkit\Kernel\LinkitKernelTestBase;
|
||||
@@ -118,7 +117,7 @@ class TermMatcherTest extends LinkitKernelTestBase {
|
||||
$vocabulary = $vocabularyStorage->create([
|
||||
'name' => $name,
|
||||
'description' => $name,
|
||||
'vid' => Unicode::strtolower($name),
|
||||
'vid' => mb_strtolower($name),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
]);
|
||||
$vocabulary->save();
|
||||
|
||||
Reference in New Issue
Block a user