コード例 #1
0
 public function testObjectTypes()
 {
     $class = new \Scrutinizer\PhpAnalyzer\Model\Clazz('Foo');
     $class->setNormalized(true);
     $this->registry->registerClass($class);
     $this->assertUnion('object<Foo>', new NamedType($this->registry, 'Foo'), $class);
     $named = new NamedType($this->registry, 'Foo');
     $named->setReferencedType($class);
     $this->assertUnion('object<Foo>', $named, $class);
 }
コード例 #2
0
 /**
  * This test differs from the other isSubTypeOf tests in that we need
  * to check the behavior of NamedType resolved against, Clazz instances.
  *
  * @group isSubTypeOf
  */
 public function testIsSubTypeOfWithForObjectTypes()
 {
     $this->registry->registerClass($foo = new Clazz('Foo'));
     $this->registry->registerClass($bar = new Clazz('Bar'));
     $foo->setSuperClasses(array('Bar'));
     $foo->setNormalized(true);
     $bar->setNormalized(true);
     $named = new NamedType($this->registry, 'Bar');
     $named->setReferencedType($bar);
     $this->assertTrue($foo->isSubTypeOf($named));
     $this->assertFalse($named->isSubTypeOf($foo));
 }