public function setUp()
 {
     parent::setUp();
     try {
         $defs = self::$base->getPropertyDefinitions();
         $this->assertInternalType('array', $defs);
         foreach ($defs as $def) {
             $this->assertInstanceOf('\\PHPCR\\NodeType\\PropertyDefinitionInterface', $def);
             switch ($def->getName()) {
                 case 'jcr:primaryType':
                     $this->primaryType = $def;
                     break;
                 case 'jcr:mixinTypes':
                     $this->mixinTypes = $def;
                     break;
             }
         }
         $this->assertNotNull($this->primaryType);
         $this->assertNotNull($this->mixinTypes);
         $defs = self::$address->getPropertyDefinitions();
         $this->assertInternalType('array', $defs);
         foreach ($defs as $def) {
             $this->assertInstanceOf('\\PHPCR\\NodeType\\PropertyDefinitionInterface', $def);
             switch ($def->getName()) {
                 case 'jcr:workspace':
                     $this->workspace = $def;
                     break;
                 case 'jcr:path':
                     $this->pathprop = $def;
                     break;
                 case 'jcr:id':
                     $this->id = $def;
                     break;
             }
         }
         $this->assertNotNull($this->workspace);
         $this->assertNotNull($this->pathprop);
         $this->assertNotNull($this->id);
         $defs = self::$mix_created->getPropertyDefinitions();
         $this->assertInternalType('array', $defs);
         foreach ($defs as $def) {
             $this->assertInstanceOf('\\PHPCR\\NodeType\\PropertyDefinitionInterface', $def);
             if ('jcr:created' == $def->getName()) {
                 $this->created = $def;
             }
         }
         $this->assertNotNull($this->created);
         $defs = self::$resource->getPropertyDefinitions();
         $this->assertInternalType('array', $defs);
         foreach ($defs as $def) {
             $this->assertInstanceOf('\\PHPCR\\NodeType\\PropertyDefinitionInterface', $def);
             if ('jcr:data' == $def->getName()) {
                 $this->data = $def;
             }
         }
         $this->assertNotNull($this->data);
     } catch (\Exception $e) {
         $this->markTestSkipped('getChildNodeDefinitions not working as it should, skipping tests about NodeDefinitionInterface: ' . $e->getMessage());
     }
 }
Ejemplo n.º 2
0
 public function testGetPropertyDefinitions()
 {
     $properties = self::$file->getPropertyDefinitions();
     $this->assertInternalType('array', $properties);
     $this->assertCount(4, $properties);
     $names = array();
     foreach ($properties as $prop) {
         $this->assertInstanceOf('\\PHPCR\\NodeType\\PropertyDefinitionInterface', $prop);
         $names[] = $prop->getName();
     }
     sort($names);
     $this->assertEquals(array('jcr:created', 'jcr:createdBy', 'jcr:mixinTypes', 'jcr:primaryType'), $names);
 }