Exemplo n.º 1
0
 /**
  * Returns an array with constants defined in this or one of its parent
  * classes.
  *
  * @return array(string=>mixed)
  */
 public function getConstants()
 {
     if ($this->_parentClass === false) {
         return parent::getConstants();
     }
     return $this->_collectConstants($this->_parentClass, parent::getConstants());
 }
 /**
  * @return void
  * @covers \pdepend\reflection\api\StaticReflectionInterface
  * @group reflection
  * @group reflection::api
  * @group unittest
  */
 public function testGetConstantsReturnsInheritConstantsButNotOverwrites()
 {
     $parent = new StaticReflectionInterface(__CLASS__, '');
     $parent->initConstants(array('T_FOO' => 42, 'T_BAR' => 23));
     $child = new StaticReflectionInterface(__CLASS__, '');
     $child->initConstants(array('T_BAR' => 13));
     $child->initInterfaces(array($parent));
     $this->assertEquals(array('T_FOO' => 42, 'T_BAR' => 13), $child->getConstants());
 }