コード例 #1
0
 /**
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage
  */
 public function testPackageInheritWhenNoneArePresent()
 {
     // Arrange
     $packageTagDescriptor = new PackageDescriptor();
     $this->fixture->setPackage('');
     $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName());
     $parentProperty->setPackage($packageTagDescriptor);
     // Act
     $result = $this->fixture->getPackage();
     // Assert
     $this->assertSame($packageTagDescriptor, $result);
 }
コード例 #2
0
 /**
  * @covers phpDocumentor\Compiler\Pass\PackageTreeBuilder::execute
  * @covers phpDocumentor\Compiler\Pass\PackageTreeBuilder::addElementsOfTypeToPackage
  */
 public function testAddConstantToNamespace()
 {
     $constant = new ConstantDescriptor();
     $constant->setPackage('My\\Space');
     $constant->setFullyQualifiedStructuralElementName('My\\Space\\Constant1');
     $this->project->getFiles()->get(0)->getConstants()->add($constant);
     // double check if a second constant in the same deep namespace ends up at the right location
     $constant2 = new ConstantDescriptor();
     $constant2->setPackage('My\\Space');
     $constant2->setFullyQualifiedStructuralElementName('My\\Space\\Constant2');
     $this->project->getFiles()->get(0)->getConstants()->add($constant2);
     $this->fixture->execute($this->project);
     $this->assertSame(array($constant, $constant2), $this->project->getIndexes()->get('packages')->get('\\My\\Space')->getConstants()->getAll());
 }