public function testExtraFieldsViaExtension() { // This extends ManyManyListTest_Secondary with the secondary extension that adds the relationship back // to the primary. The instance from the fixture is ManyManyListTest_SecondarySub, deliberately a sub-class of // the extended class. Object::add_extension('ManyManyListTest_Secondary', 'ManyManyListTest_IndirectSecondaryExtension'); // Test from the primary (not extended) to the secondary (which is extended) $primary = $this->objFromFixture('ManyManyListTest_IndirectPrimary', 'manymany_extra_primary'); $secondaries = $primary->Secondary(); $extraFields = $secondaries->getExtraFields(); $this->assertTrue(count($extraFields) > 0, 'has extra fields'); $this->assertTrue(isset($extraFields['DocumentSort']), 'has DocumentSort'); // Test from the secondary (which is extended) to the primary (not extended) $secondary = $this->objFromFixture('ManyManyListTest_SecondarySub', 'manymany_extra_secondary'); $primaries = $secondary->Primary(); $extraFields = $primaries->getExtraFields(); $this->assertTrue(count($extraFields) > 0, 'has extra fields'); $this->assertTrue(isset($extraFields['DocumentSort']), 'has DocumentSort'); }