Commit 062b8731 authored by generalredneck's avatar generalredneck

[#1614234] Fixing Reindex bug and storage bug. Added a test.

parent 6e05af69
......@@ -120,14 +120,14 @@ function views_natural_sort_rebuild_index(&$context) {
}
}
$results = array_slice($index_entries, $sandbox['current'], 10);
$results = array_slice($index_entries, $sandbox['current'], 100);
$entity_type = '';
$field = '';
foreach ($results as $row) {
views_natural_sort_store($row);
++$sandbox['progress'];
$sandbox['current'] = $row->nid;
$sandbox['current'] = $sandbox['progress'];
$entity_type = $row['entity_type'];
$field = $row['field'];
++$context['results']['entries'];
......
......@@ -6,3 +6,4 @@ core = 7.x
; Views handlers
files[] = handlers/views_natural_sort_handler_sort.inc
files[] = views_natrual_sort.test
......@@ -241,7 +241,7 @@ function views_natural_sort_views_natural_sort_get_rebuild_data(){
->execute();
$data = array();
foreach ($result as $row ) {
$data[] = _views_natural_sort_node_to_vns($node);
$data[] = _views_natural_sort_node_to_vns($row);
}
return $data;
}
......
<?php
class ViewsNaturalSortTest extends DrupalUnitTestCase {
public static function getInfo() {
return array(
'name' => 'Views Natural Sort Tests',
'description' => 'Test that Views Natural Sort Module works correctly.',
'group' => 'VNS',
);
}
public function testNodeAdd(){
$node = new StdClass();
$node->type = 'article';
node_object_prepare($node);
$node->title = 'All American';
$node->status = 1;
node_save($node);
$this->assertNotNull($node->nid, 'The test node did not save properly.');
$vns_entry = db_select('views_natural_sort','vns')
->fields('vns')
->condition('eid', $node->nid)
->execute()
->fetchAssoc();
$this->assertEqual($vns_entry, array(
'eid' => $node->nid,
'entity_type' => 'node',
'field' => 'title',
'delta' => '0',
'content' => 'All American'
));
}
public function testNodeRemove(){
$this->assertTrue(FALSE);
}
public function testNodeChange(){
$this->assertTrue(FALSE);
}
public function testRemoveBeginningWordsTransformation(){
$this->assertTrue(FALSE);
}
public function testRemoveWordsTransformation(){
$this->assertTrue(FALSE);
}
public function testNumberTransfomration(){
$this->assertTrue(FALSE);
}
public function testViewSort(){
$this->assertTrue(FALSE);
}
}
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