public function testGetDerivedTypes() { $fakeName = "FakeType"; Phockito::when($this->mockMetadataProvider->getDerivedTypes($this->mockResourceType))->return(array($this->mockResourceType2)); Phockito::when($this->mockResourceType->getName())->return($fakeName); $wrapper = $this->getMockedWrapper(); $actual = $wrapper->getDerivedTypes($this->mockResourceType); $this->assertEquals(array($this->mockResourceType2), $actual); }
/** * The method must return a collection of all the types derived from * $resourceType The collection returned should NOT include the type * passed in as a parameter * Note: Wrapper for IMetadataProvider::getDerivedTypes * method implementation * * @param ResourceType $resourceType Resource to get derived resource types from * * @return ResourceType[] * * @throws InvalidOperationException when the meat provider doesn't return an array */ public function getDerivedTypes(ResourceType $resourceType) { $derivedTypes = $this->metaProvider->getDerivedTypes($resourceType); if (!is_array($derivedTypes)) { throw new InvalidOperationException(Messages::metadataAssociationTypeSetInvalidGetDerivedTypesReturnType($resourceType->getName())); } foreach ($derivedTypes as $derivedType) { $this->_validateResourceType($derivedType); } return $derivedTypes; }