/** * @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()); }
/** * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties */ public function testGetInheritedPropertiesWithClassDescriptorParent() { $collectionMock = m::mock('phpDocumentor\\Descriptor\\Collection'); $collectionMock->shouldReceive('get'); $mock = m::mock('phpDocumentor\\Descriptor\\ClassDescriptor'); $mock->shouldReceive('getProperties')->andReturn(new Collection(array('properties'))); $mock->shouldReceive('getInheritedProperties')->andReturn(new Collection(array('inherited'))); $this->fixture->setParent($mock); $result = $this->fixture->getInheritedProperties(); $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $result); $expected = array('properties', 'inherited'); $this->assertSame($expected, $result->getAll()); }