Skip to content

Commit 9d28f60

Browse files
committed
adding tests for Property::getDefinition
1 parent ca986fe commit 9d28f60

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/08_NodeTypeDiscovery/PropertyDefinitionTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PropertyDefinitionTest extends \PHPCR\Test\BaseCase
3030

3131
static public function setupBeforeClass($fixtures = false)
3232
{
33-
parent::setupBeforeClass($fixtures);
33+
parent::setupBeforeClass(); // load default fixtures
3434
$ntm = self::$staticSharedFixture['session']->getWorkspace()->getNodeTypeManager();
3535
self::$base = $ntm->getNodeType('nt:base');
3636
self::$address = $ntm->getNodeType('nt:address');
@@ -41,6 +41,7 @@ static public function setupBeforeClass($fixtures = false)
4141

4242
public function setUp()
4343
{
44+
parent::setUp();
4445
try {
4546
$defs = self::$base->getPropertyDefinitions();
4647
$this->assertInternalType('array', $defs);
@@ -217,4 +218,24 @@ public function testIsProtected()
217218
$this->assertTrue($this->created->isProtected());
218219
$this->assertFalse($this->data->isProtected());
219220
}
221+
222+
// some tests about Property::getDefinition()
223+
224+
public function testGetPropertyDefinitionExact()
225+
{
226+
$node = $this->rootNode->getNode('tests_general_base');
227+
$createdProperty = $node->getProperty('jcr:created');
228+
$propDef = $createdProperty->getDefinition();
229+
$this->assertInstanceOf('PHPCR\\NodeType\\PropertyDefinitionInterface', $propDef);
230+
$this->assertEquals('jcr:created', $propDef->getName());
231+
}
232+
233+
public function estGetPropertyDefinitionWildcard()
234+
{
235+
$node = $this->rootNode->getNode('tests_general_base/numberPropertyNode/jcr:content');
236+
$valProperty = $node->getProperty('foo');
237+
$propDef = $valProperty->getDefinition();
238+
$this->assertInstanceOf('PHPCR\\NodeType\\PropertyDefinitionInterface', $propDef);
239+
$this->assertEquals('*', $propDef->getName());
240+
}
220241
}

0 commit comments

Comments
 (0)