Commit 244f9679 authored by generalredneck's avatar generalredneck

pulling in fixes from 8.x-2.x

parents 3268c0d0 e2159b05
...@@ -64,7 +64,7 @@ class IndexRecord { ...@@ -64,7 +64,7 @@ class IndexRecord {
foreach ($this->transformations as $transformation) { foreach ($this->transformations as $transformation) {
$transformed_content = $transformation->transform($transformed_content); $transformed_content = $transformation->transform($transformed_content);
} }
return substr($transformed_content, 0, 255); return mb_substr($transformed_content, 0, 255);
} }
private function generateType() { private function generateType() {
$this->type = new IndexRecordType($this->entityType, $this->field); $this->type = new IndexRecordType($this->entityType, $this->field);
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
namespace Drupal\views_natural_sort; namespace Drupal\views_natural_sort;
use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\ConfigFactory;
<<<<<<< HEAD
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
=======
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Entity\EntityInterface;
>>>>>>> 8.x-2.x
use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
...@@ -24,7 +29,11 @@ class ViewsNaturalSortService { ...@@ -24,7 +29,11 @@ class ViewsNaturalSortService {
/** /**
* Constructor. * Constructor.
*/ */
<<<<<<< HEAD
public function __construct(TransformationManager $transformationManager, ConfigFactory $configFactory, ModuleHandlerInterface $moduleHandler, LoggerChannelFactory $loggerFactory, Connection $database, ViewsData $viewsData, QueueFactory $queue, QueueWorkerManagerInterface $queueManager, EntityFieldManagerInterface $entityFieldManager, EntityTypeManagerInterface $entityTypeManager, FieldTypePluginManager $fieldTypeManager, EntrySourcePluginManager $entry_source_plugin_manager) { public function __construct(TransformationManager $transformationManager, ConfigFactory $configFactory, ModuleHandlerInterface $moduleHandler, LoggerChannelFactory $loggerFactory, Connection $database, ViewsData $viewsData, QueueFactory $queue, QueueWorkerManagerInterface $queueManager, EntityFieldManagerInterface $entityFieldManager, EntityTypeManagerInterface $entityTypeManager, FieldTypePluginManager $fieldTypeManager, EntrySourcePluginManager $entry_source_plugin_manager) {
=======
public function __construct(TransformationManager $transformationManager, ConfigFactory $configFactory, ModuleHandlerInterface $moduleHandler, LoggerChannelFactoryInterface $loggerFactory, Connection $database, ViewsData $viewsData, QueueFactory $queue, QueueWorkerManagerInterface $queueManager, EntityFieldManagerInterface $entityFieldManager, EntityTypeManagerInterface $entityTypeManager) {
>>>>>>> 8.x-2.x
$this->configFactory = $configFactory; $this->configFactory = $configFactory;
$this->moduleHandler = $moduleHandler; $this->moduleHandler = $moduleHandler;
$this->loggerFactory = $loggerFactory->get('views_natural_sort'); $this->loggerFactory = $loggerFactory->get('views_natural_sort');
......
...@@ -180,7 +180,7 @@ class BasicTest extends ViewsKernelTestBase { ...@@ -180,7 +180,7 @@ class BasicTest extends ViewsKernelTestBase {
'title' => '-3.5501 apples', 'title' => '-3.5501 apples',
]); ]);
$node8->save(); $node8->save();
$node9 = Node::create([ $node9 = node::create([
'type' => 'views_natural_sort_test_content', 'type' => 'views_natural_sort_test_content',
'title' => '3.5501 apples', 'title' => '3.5501 apples',
]); ]);
...@@ -268,4 +268,18 @@ class BasicTest extends ViewsKernelTestBase { ...@@ -268,4 +268,18 @@ class BasicTest extends ViewsKernelTestBase {
$this->assertEqual($properties, $expected_result); $this->assertEqual($properties, $expected_result);
} }
public function testStoringLongUnicode() {
$node = node::create([
'type' => 'views_natural_sort_test_content',
'title' => str_repeat('⌘', 255),
]);
$node->save();
$content = db_select('views_natural_sort', 'vns')
->fields('vns', ['content'])
->condition('vns.eid', $node->id())
->condition('vns.entity_type', 'node')
->execute()
->fetchField();
$this->assertEqual($content, str_repeat('⌘', 255));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment