public function testDynamicDateTimeAttributeOnForm() { $searchForm = new ASearchFormTestModel(new MixedRelationsModel()); //Test get and set. $this->assertEquals(null, $searchForm->dateTime__DateTime); $searchForm->dateTime__DateTime = 'aTest'; $this->assertEquals('aTest', $searchForm->dateTime__DateTime); //Check some other methods to make sure they work ok. $this->assertFalse($searchForm->isRelation('dateTime__DateTime')); $this->assertTrue($searchForm->isAttribute('dateTime__DateTime')); $this->assertFalse($searchForm->isAttributeRequired('dateTime__DateTime')); //Test attributeRules and attributeLabels $attributeLabels = $searchForm->attributeLabels(); $this->assertEquals('Date Time', $attributeLabels['dateTime__DateTime']); $this->assertEquals('Date Time 2', $attributeLabels['dateTime2__DateTime']); //Test additional methods. $mappedData = $searchForm->getAttributesMappedToRealAttributesMetadata(); $this->assertEquals('resolveEntireMappingByRules', $mappedData['dateTime__DateTime']); $mappingRulesType = $searchForm->getSearchFormAttributeMappingRulesTypeByAttribute('dateTime__DateTime'); $this->assertEquals('MixedDateTimeTypes', $mappingRulesType); //Test that the correct elements are used for the dynamic date attribute. $elementType = ModelAttributeToMixedTypeUtil::getType($searchForm, 'dateTime__DateTime'); $this->assertEquals('MixedDateTypesForSearch', $elementType); }