コード例 #1
0
 /**
  * @covers ClassTypeDescription
  */
 public function testInstantiateAndCheck()
 {
     $typeDescription = new ClassTypeDescription('lib.pkp.tests.classes.filter.TestClass1');
     $compatibleObject = new TestClass1();
     $wrongObject = new TestClass2();
     self::assertTrue($typeDescription->isCompatible($compatibleObject));
     self::assertFalse($typeDescription->isCompatible($wrongObject));
 }
コード例 #2
0
 /**
  * @see TypeDescription::checkType()
  */
 function checkType(&$object)
 {
     // First of all check whether this is a
     // meta-data description at all.
     if (!parent::checkType($object)) {
         return false;
     }
     // Check the meta-data schema.
     $metadataSchema =& $object->getMetadataSchema();
     if (!is_a($metadataSchema, $this->_metadataSchemaClassName)) {
         return false;
     }
     // Check the assoc type
     if ($this->_assocType != ASSOC_TYPE_ANY) {
         if ($object->getAssocType() != $this->_assocType) {
             return false;
         }
     }
     return true;
 }