/** * testIteratorReturnsSameClassOnlyOnce * * @return void */ public function testIteratorReturnsSameClassOnlyOnce() { $class1 = new PHP_Depend_Code_Class('c1'); $class1->setUuid(md5(23)); $class2 = new PHP_Depend_Code_Class('c2'); $class2->setUuid(md5(23)); $reference1 = $this->getMockBuilder(PHP_Depend_Code_ASTSelfReference::CLAZZ)->disableOriginalConstructor()->getMock(); $reference1->expects($this->once())->method('getType')->will($this->returnValue($class1)); $reference2 = $this->getMockBuilder(PHP_Depend_Code_ASTSelfReference::CLAZZ)->disableOriginalConstructor()->getMock(); $reference2->expects($this->once())->method('getType')->will($this->returnValue($class2)); $references = array($reference1, $reference2); $refs = new PHP_Depend_Code_ClassOrInterfaceReferenceIterator($references); $types = array(); foreach ($refs as $type) { $types[] = $type->getUuid(); } $this->assertEquals(array($class1->getUuid()), $types); }
/** * testBuilderCreatesExpectedIdentifierForMethod * * @return void */ 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)); }