Skip to content
Permalink
Browse files

Added min and max tests to the ResultSet test

  • Loading branch information...
davidyell committed Oct 26, 2018
1 parent 46b3688 commit 64f8f0f7e5f682c0c6fc170a1ca21ae9588a1166
Showing with 31 additions and 0 deletions.
  1. +31 −0 tests/TestCase/ORM/ResultSetTest.php
@@ -21,6 +21,7 @@
use Cake\ORM\ResultSet;
use Cake\ORM\Table;
use Cake\TestSuite\TestCase;
use TestApp\Model\Entity\Article;
/**
* ResultSet test case.
@@ -416,4 +417,34 @@ public function testIsEmptyDoesNotConsumeData()
$res->isEmpty();
$this->assertCount(6, $res->toArray());
}
/**
* Test that ResultSet implements the CollectionInterface min method
*
* @return void
*/
public function testCollectionMin()
{
$query = $this->table->find('all');
$result = $query->min('id');
$expected = $this->table->get(1);
$this->assertEquals($expected, $result);
}
/**
* Test that ResultSet implements the CollectionInterface max method
*
* @return void
*/
public function testCollectionMax()
{
$query = $this->table->find('all');
$result = $query->max('id');
$expected = $this->table->get(3);
$this->assertEquals($expected, $result);
}
}

0 comments on commit 64f8f0f

Please sign in to comment.
You can’t perform that action at this time.