From 0595d8b7a8d9430b039f291ca2ff38bb60cd9983 Mon Sep 17 00:00:00 2001
From: Benaka Moorthi <benaka.moorthi@gmail.com>
Date: Mon, 19 Aug 2013 22:17:18 -0400
Subject: [PATCH] Fixing build.

---
 core/DataTable/Filter/Limit.php             |  4 ----
 core/ViewDataTable.php                      |  8 +++++++-
 tests/PHPUnit/Plugins/SegmentEditorTest.php | 15 +++++++++++++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/core/DataTable/Filter/Limit.php b/core/DataTable/Filter/Limit.php
index f56b0b8011..e040244a0b 100644
--- a/core/DataTable/Filter/Limit.php
+++ b/core/DataTable/Filter/Limit.php
@@ -45,10 +45,6 @@ class Limit extends Filter
      */
     public function filter($table)
     {
-        if ($this->limit <= 0) {
-            return;
-        }
-        
         $table->setRowsCountBeforeLimitFilter();
 
         if ($this->keepSummaryRow) {
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index 92c59b7b22..533cef4bb2 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -705,6 +705,12 @@ class ViewDataTable
 
         $requestArray = array_merge($requestArray, $this->request_parameters_to_modify);
 
+        if (!empty($requestArray['filter_limit'])
+            && $requestArray['filter_limit'] === 0
+        ) {
+            unset($requestArray['filter_limit']);
+        }
+
         return $requestArray;
     }
 
@@ -1254,4 +1260,4 @@ class ViewDataTable
     {
         return is_bool($value) ? (int)$value : $value;
     }
-}
+}
\ No newline at end of file
diff --git a/tests/PHPUnit/Plugins/SegmentEditorTest.php b/tests/PHPUnit/Plugins/SegmentEditorTest.php
index 696f19bcbc..12f7cc7138 100644
--- a/tests/PHPUnit/Plugins/SegmentEditorTest.php
+++ b/tests/PHPUnit/Plugins/SegmentEditorTest.php
@@ -140,6 +140,11 @@ class SegmentEditorTest extends DatabaseTestCase
         );
 
         $newSegment = API::getInstance()->get($idSegment2);
+
+        // avoid test failures for when ts_created/ts_last_edit are different by between 1/2 secs
+        $this->removeSecondsFromSegmentInfo($updatedSegment);
+        $this->removeSecondsFromSegmentInfo($newSegment);
+
         $this->assertEquals($newSegment, $updatedSegment);
 
         // Check the other segmenet was not updated
@@ -164,4 +169,14 @@ class SegmentEditorTest extends DatabaseTestCase
         // and this should work
         API::getInstance()->get($idSegment1);
     }
+
+    private function removeSecondsFromSegmentInfo(&$segmentInfo)
+    {
+        $timestampProperties = array('ts_last_edit', 'ts_created');
+        foreach ($timestampProperties as $propertyName) {
+            if (isset($segmentInfo[$propertyName])) {
+                $segmentInfo[$propertyName] = substr($segmentInfo[$propertyName], 0, strlen($segmentInfo[$propertyName] - 2));
+            }
+        }
+    }
 }
-- 
GitLab