@@ -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