/** * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicProperties */ public function testMagicPropertiesReturnsExpectedCollectionWithTags() { $mockTagPropertyDescriptor = m::mock('phpDocumentor\\Descriptor\\Tag\\PropertyDescriptor'); $mockTagPropertyDescriptor->shouldReceive('getVariableName')->andReturn('Sample'); $mockTagPropertyDescriptor->shouldReceive('getDescription')->andReturn('Sample description'); $mockTagPropertyDescriptor->shouldReceive('getTypes')->andReturn(new Collection()); $propertyCollection = new Collection(array($mockTagPropertyDescriptor)); $this->fixture->getTags()->set('property', $propertyCollection); $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $this->fixture->getMagicProperties()); $magicPropertiesCollection = $this->fixture->getMagicProperties(); $this->assertSame(1, $magicPropertiesCollection->count()); $this->assertSame('Sample', $magicPropertiesCollection[0]->getName()); $this->assertSame('Sample description', $magicPropertiesCollection[0]->getDescription()); $this->assertInstanceOf('phpDocumentor\\Descriptor\\Collection', $magicPropertiesCollection[0]->getTypes()); $this->assertSame(0, $magicPropertiesCollection[0]->getTypes()->count()); $this->assertSame($this->fixture, $magicPropertiesCollection[0]->getParent()); }