Permalink
Browse files

adding tests for Property::getDefinition

  • Loading branch information...
1 parent ca986fe commit 9d28f602467ed9e9a427a9d6514ed32ad8778ea6 @dbu dbu committed Aug 29, 2012
Showing with 22 additions and 1 deletion.
  1. +22 −1 tests/08_NodeTypeDiscovery/PropertyDefinitionTest.php
@@ -30,7 +30,7 @@ class PropertyDefinitionTest extends \PHPCR\Test\BaseCase
static public function setupBeforeClass($fixtures = false)
{
- parent::setupBeforeClass($fixtures);
+ parent::setupBeforeClass(); // load default fixtures
$ntm = self::$staticSharedFixture['session']->getWorkspace()->getNodeTypeManager();
self::$base = $ntm->getNodeType('nt:base');
self::$address = $ntm->getNodeType('nt:address');
@@ -41,6 +41,7 @@ static public function setupBeforeClass($fixtures = false)
public function setUp()
{
+ parent::setUp();
try {
$defs = self::$base->getPropertyDefinitions();
$this->assertInternalType('array', $defs);
@@ -217,4 +218,24 @@ public function testIsProtected()
$this->assertTrue($this->created->isProtected());
$this->assertFalse($this->data->isProtected());
}
+
+ // some tests about Property::getDefinition()
+
+ public function testGetPropertyDefinitionExact()
+ {
+ $node = $this->rootNode->getNode('tests_general_base');
+ $createdProperty = $node->getProperty('jcr:created');
+ $propDef = $createdProperty->getDefinition();
+ $this->assertInstanceOf('PHPCR\\NodeType\\PropertyDefinitionInterface', $propDef);
+ $this->assertEquals('jcr:created', $propDef->getName());
+ }
+
+ public function estGetPropertyDefinitionWildcard()
+ {
+ $node = $this->rootNode->getNode('tests_general_base/numberPropertyNode/jcr:content');
+ $valProperty = $node->getProperty('foo');
+ $propDef = $valProperty->getDefinition();
+ $this->assertInstanceOf('PHPCR\\NodeType\\PropertyDefinitionInterface', $propDef);
+ $this->assertEquals('*', $propDef->getName());
+ }
}

0 comments on commit 9d28f60

Please sign in to comment.