/**
  * @depends testGetReportableAttributes
  * Testing where a model relates to another model via something like Item. An example is notes which connects
  * to accounts via activityItems MANY_MANY through Items.  On Notes we need to be able to show  these relations
  * as selectable in reporting.
  *
  * In this example ReportModelTestItem5 connects to ReportModelTestItem and ReportModelTestItem2
  * via MANY_MANY through Item using the reportItems relation
  * Known as viaRelations: model5ViaItem on ReportModelItem and model5ViaItem on ReportModelItem2
  */
 public function testGetInferredRelationsData()
 {
     $model = new ReportModelTestItem5();
     $rules = new ReportsTestReportRules();
     $report = new Report();
     $report->setType(Report::TYPE_ROWS_AND_COLUMNS);
     $report->setModuleClassName('ReportsTestModule');
     $adapter = new ModelRelationsAndAttributesToReportAdapter($model, $rules, $report->getType());
     $relations = $adapter->getInferredRelationsData();
     $this->assertEquals(2, count($relations));
     $compareData = array('label' => 'Reports Tests');
     $this->assertEquals($compareData, $relations['ReportModelTestItem__reportItems__Inferred']);
     $compareData = array('label' => 'ReportModelTestItem2s');
     $this->assertEquals($compareData, $relations['ReportModelTestItem2__reportItems__Inferred']);
     //Getting all selectable relations. Should yield all 3 relations
     $adapter = new ModelRelationsAndAttributesToReportAdapter($model, $rules, $report->getType());
     $relations = $adapter->getSelectableRelationsData();
     $this->assertEquals(6, count($relations));
     $compareData = array('label' => 'Reports Tests');
     $this->assertEquals($compareData, $relations['ReportModelTestItem__reportItems__Inferred']);
     $compareData = array('label' => 'ReportModelTestItem2s');
     $this->assertEquals($compareData, $relations['ReportModelTestItem2__reportItems__Inferred']);
     $compareData = array('label' => 'Report Items');
     $this->assertEquals($compareData, $relations['reportItems']);
     //Add Dynamically Derived Attributes
     $compareData = array('label' => 'Owner');
     $this->assertEquals($compareData, $relations['owner']);
     $compareData = array('label' => 'Created By User');
     $this->assertEquals($compareData, $relations['createdByUser']);
     $compareData = array('label' => 'Modified By User');
     $this->assertEquals($compareData, $relations['modifiedByUser']);
 }