min() public method

Get the min value of a given key.
public min ( string $key ) : mixed
$key string
return mixed
Ejemplo n.º 1
0
 /**
  * @group           DataModel
  * @group           CollectionMin
  * @covers          FOF30\Model\DataModel\Collection::min
  */
 public function testMin()
 {
     $items = $this->buildCollection();
     $collection = new Collection($items);
     $result = $collection->min('foftest_bare_id');
     // Let's get the maximum value directly from the db
     $db = \JFactory::getDbo();
     $query = $db->getQuery(true)->select('MIN(foftest_bare_id)')->from('#__foftest_bares');
     $min = $db->setQuery($query)->loadResult();
     $this->assertEquals($min, $result, 'Collection::min Failed to return lowest value');
 }