/** * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties * @ticket https://github.com/phpDocumentor/phpDocumentor2/issues/1307 */ public function testRetrievingInheritedPropertiesDoesNotCrashWhenUsedTraitIsNotInProject() { // Arrange $expected = array(); // unknown traits are not converted to TraitDescriptors but kept as strings $this->fixture->setUsedTraits(new Collection(array('unknownTrait'))); // Act $result = $this->fixture->getInheritedProperties(); // Assert $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $result); $this->assertSame($expected, $result->getAll()); }
/** * Registers the used traits with the generated Class Descriptor. * * @param string[] $traits * @param ClassDescriptor $classDescriptor * * @return void */ protected function addUses(array $traits, ClassDescriptor $classDescriptor) { $classDescriptor->setUsedTraits(new Collection($traits)); }