|
|
@@ -859,6 +859,34 @@ class QueryTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Test clearResult()
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testClearResult()
|
|
|
+ {
|
|
|
+ $article = $this->getTableLocator()->get('articles');
|
|
|
+ $query = new Query($this->connection, $article);
|
|
|
+
|
|
|
+ $firstCount = $query->count();
|
|
|
+ $firstResults = $query->toList();
|
|
|
+
|
|
|
+ $this->assertEquals(3, $firstCount);
|
|
|
+ $this->assertCount(3, $firstResults);
|
|
|
+
|
|
|
+ $article->delete(reset($firstResults));
|
|
|
+ $return = $query->clearResult();
|
|
|
+
|
|
|
+ $this->assertSame($return, $query);
|
|
|
+
|
|
|
+ $secondCount = $query->count();
|
|
|
+ $secondResults = $query->toList();
|
|
|
+
|
|
|
+ $this->assertEquals(2, $secondCount);
|
|
|
+ $this->assertCount(2, $secondResults);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Tests that applying array options to a query will convert them
|
|
|
* to equivalent function calls with the correspondent array values
|
|
|
*
|