/** * @group DataModel * @group CollectionMax * @covers FOF30\Model\DataModel\Collection::max */ public function testMax() { $items = $this->buildCollection(); $collection = new Collection($items); $result = $collection->max('foftest_bare_id'); // Let's get the maximum value directly from the db $db = \JFactory::getDbo(); $query = $db->getQuery(true)->select('MAX(foftest_bare_id)')->from('#__foftest_bares'); $max = $db->setQuery($query)->loadResult(); $this->assertEquals($max, $result, 'Collection::max Failed to return highest value'); }