/**
  * Mock an attribute.
  *
  * @param IMetaModel $metaModel The metamodel.
  *
  * @param array      $values    The test values.
  *
  * @return \MetaModels\Attribute\ISimple
  */
 protected function mockAttribute($metaModel, $values = array())
 {
     $attributeData = array('id' => 1, 'colname' => 'testAttribute', 'name' => 'Test Attribute');
     $attribute = $this->getMock('\\MetaModels\\Attribute\\BaseSimple', array('filterGreaterThan', 'filterLessThan', 'get'), array($metaModel, $attributeData));
     $attribute->expects($this->any())->method('getColName')->will($this->returnValue($attributeData['colname']));
     $attribute->expects($this->any())->method('filterGreaterThan')->will($this->returnCallback(function ($testValue, $inclusive = false) use($values) {
         $ids = array();
         foreach ($values as $itemId => $value) {
             if ($inclusive) {
                 if ($value >= $testValue) {
                     $ids[] = $itemId;
                 }
             } elseif ($value > $testValue) {
                 $ids[] = $itemId;
             }
         }
         return $ids;
     }));
     $attribute->expects($this->any())->method('filterLessThan')->will($this->returnCallback(function ($testValue, $inclusive = false) use($values) {
         $ids = array();
         foreach ($values as $itemId => $value) {
             if ($inclusive) {
                 if ($value <= $testValue) {
                     $ids[] = $itemId;
                 }
             } elseif ($value < $testValue) {
                 $ids[] = $itemId;
             }
         }
         return $ids;
     }));
     /** @var \MetaModels\Attribute\ISimple $attribute */
     $metaModel->addAttribute($attribute);
     return $attribute;
 }