Пример #1
0
 /**
  * Tests that the {@link PHP_Depend_Code_Method::getParent()} returns as
  * default value <b>null</b> and that the package could be set and unset.
  *
  * @return void
  */
 public function testGetSetParent()
 {
     $class = new PHP_Depend_Code_Class('clazz', 0, 'clazz.php');
     $method = new PHP_Depend_Code_Method('method');
     $method->setParent($class);
     self::assertSame($class, $method->getParent());
 }
Пример #2
0
 /**
  * testBuilderCreatesCaseInSensitiveMethodIdentifiers
  *
  * @return void
  */
 public function testBuilderCreatesCaseInSensitiveMethodIdentifiers()
 {
     $file = new PHP_Depend_Code_File(__FILE__);
     $file->setUuid(__FUNCTION__);
     $class = new PHP_Depend_Code_Class(__FUNCTION__);
     $class->setSourceFile($file);
     $method0 = new PHP_Depend_Code_Method(__FUNCTION__);
     $method0->setParent($class);
     $method1 = new PHP_Depend_Code_Method(strtolower(__FUNCTION__));
     $method1->setParent($class);
     $builder0 = new PHP_Depend_Util_UuidBuilder();
     $builder1 = new PHP_Depend_Util_UuidBuilder();
     self::assertEquals($builder0->forMethod($method0), $builder1->forMethod($method1));
 }
Пример #3
0
 /**
  * Adds the given method to this type.
  *
  * @param PHP_Depend_Code_Method $method A new type method.
  *
  * @return PHP_Depend_Code_Method
  */
 public function addMethod(PHP_Depend_Code_Method $method)
 {
     $method->setParent($this);
     $this->methods[] = $method;
     return $method;
 }
Пример #4
0
 /**
  * testBuilderCreatesExpectedIdentifierForMethod
  *
  * @return void
  * @covers PHP_Depend_Util_UuidBuilder
  * @group pdepend
  * @group pdepend::util
  * @group unittest
  */
 public function testBuilderCreatesExpectedIdentifierForMethod()
 {
     $class = new PHP_Depend_Code_Class(__CLASS__);
     $class->setUUID('FooBar');
     $method = new PHP_Depend_Code_Method(__FUNCTION__);
     $method->setParent($class);
     $builder = new PHP_Depend_Util_UuidBuilder();
     $this->assertRegExp('/^FooBar\\-[a-z0-9]{11}$/', $builder->forMethod($method));
 }