diff --git a/tests/TestCase/ORM/ResultSetTest.php b/tests/TestCase/ORM/ResultSetTest.php index 45331633349..982791b206e 100644 --- a/tests/TestCase/ORM/ResultSetTest.php +++ b/tests/TestCase/ORM/ResultSetTest.php @@ -436,4 +436,21 @@ public function testCollectionMinAndMax() $this->assertEquals($minExpected, $min); $this->assertEquals($maxExpected, $max); } + + /** + * Test that ResultSet + * + * @return void + */ + public function testCollectionMinAndMaxWithAggregateField() + { + $query = $this->table->find(); + $query->select(['count' => 'length(title)']); + + $min = $query->min('count'); + $max = $query->max('count'); + + $this->assertEquals(13, $min->count); + $this->assertEquals(14, $max->count); + } }