/** * @depends testGetAvailableRelationsDoesNotCauseFeedbackLoop */ public function testGetReportableAttributes() { $model = new ReportModelTestItem(); $rules = new ReportsTestReportRules(); $report = new Report(); $report->setType(Report::TYPE_ROWS_AND_COLUMNS); $report->setModuleClassName('ReportsTestModule'); $adapter = new ModelRelationsAndAttributesToReportAdapter($model, $rules, $report->getType()); $attributes = $adapter->getAttributesIncludingDerivedAttributesData(); $this->assertEquals(28, count($attributes)); $compareData = array('label' => 'Id'); $this->assertEquals($compareData, $attributes['id']); $compareData = array('label' => 'Created Date Time'); $this->assertEquals($compareData, $attributes['createdDateTime']); $compareData = array('label' => 'Modified Date Time'); $this->assertEquals($compareData, $attributes['modifiedDateTime']); $compareData = array('label' => 'First Name'); $this->assertEquals($compareData, $attributes['firstName']); $compareData = array('label' => 'Last Name'); $this->assertEquals($compareData, $attributes['lastName']); $compareData = array('label' => 'Boolean'); $this->assertEquals($compareData, $attributes['boolean']); $compareData = array('label' => 'Date'); $this->assertEquals($compareData, $attributes['date']); $compareData = array('label' => 'Date Time'); $this->assertEquals($compareData, $attributes['dateTime']); $compareData = array('label' => 'Float'); $this->assertEquals($compareData, $attributes['float']); $compareData = array('label' => 'Integer'); $this->assertEquals($compareData, $attributes['integer']); $compareData = array('label' => 'Phone'); $this->assertEquals($compareData, $attributes['phone']); $compareData = array('label' => 'String'); $this->assertEquals($compareData, $attributes['string']); $compareData = array('label' => 'Text Area'); $this->assertEquals($compareData, $attributes['textArea']); $compareData = array('label' => 'Url'); $this->assertEquals($compareData, $attributes['url']); $compareData = array('label' => 'Drop Down'); $this->assertEquals($compareData, $attributes['dropDown']); $compareData = array('label' => 'Drop Down 2'); $this->assertEquals($compareData, $attributes['dropDown2']); $compareData = array('label' => 'Radio Drop Down'); $this->assertEquals($compareData, $attributes['radioDropDown']); $compareData = array('label' => 'Multi Drop Down'); $this->assertEquals($compareData, $attributes['multiDropDown']); $compareData = array('label' => 'Tag Cloud'); $this->assertEquals($compareData, $attributes['tagCloud']); $compareData = array('label' => 'Reported As Attribute'); $this->assertEquals($compareData, $attributes['reportedAsAttribute']); //Currency is treated as a relation reported as an attribute just like drop downs $compareData = array('label' => 'Currency Value'); $this->assertEquals($compareData, $attributes['currencyValue']); //likeContactState is a relation reported as attribute. //Makes sure the label is using the proper label translation via attributeLabels $compareData = array('label' => 'A name for a state'); $this->assertEquals($compareData, $attributes['likeContactState']); //Includes derived attributes as well $compareData = array('label' => 'Test Calculated', 'derivedAttributeType' => 'CalculatedNumber'); $this->assertEquals($compareData, $attributes['calculated']); $compareData = array('label' => 'ID', 'derivedAttributeType' => 'UniqueIdentifier'); $this->assertEquals($compareData, $attributes['UniqueIdentifier']); $compareData = array('label' => 'Full Name', 'derivedAttributeType' => 'FullName'); $this->assertEquals($compareData, $attributes['FullName']); //Add Dynamically Derived Attributes $compareData = array('label' => 'Owner'); $this->assertEquals($compareData, $attributes['owner__User']); $compareData = array('label' => 'Created By User'); $this->assertEquals($compareData, $attributes['createdByUser__User']); $compareData = array('label' => 'Modified By User'); $this->assertEquals($compareData, $attributes['modifiedByUser__User']); }