Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added functional test for bug PHPCR-78

  • Loading branch information...
commit a7e1ba83d78771599181d2dee3c03c5163cf26e7 1 parent 72a370e
Damien Pitard authored
79  tests/Doctrine/Tests/ODM/PHPCR/Functional/ProtectedPropertyTest.php
... ...
@@ -0,0 +1,79 @@
  1
+<?php
  2
+
  3
+namespace Doctrine\Tests\ODM\PHPCR\Functional;
  4
+
  5
+use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
  6
+
  7
+/**
  8
+ * @group functional
  9
+ */
  10
+class ProtectedPropertyTest extends \Doctrine\Tests\ODM\PHPCR\PHPCRFunctionalTestCase
  11
+{
  12
+    /**
  13
+     * @var \Doctrine\ODM\PHPCR\DocumentManager
  14
+     */
  15
+    private $dm;
  16
+
  17
+    /**
  18
+     * Class name of the document class
  19
+     * @var string
  20
+     */
  21
+    private $type;
  22
+
  23
+    /**
  24
+     * @var \PHPCR\NodeInterface
  25
+     */
  26
+    private $node;
  27
+
  28
+    public function setUp()
  29
+    {
  30
+        $this->type = 'Doctrine\Tests\ODM\PHPCR\Functional\ProtectedPropertyTestObj';
  31
+        $this->dm = $this->createDocumentManager();
  32
+        $this->node = $this->resetFunctionalNode($this->dm);
  33
+
  34
+        $cnd = <<<CND
  35
+<test='http://test.fr'>
  36
+[test:protected_property_test] > nt:hierarchyNode
  37
+  - reference (REFERENCE)
  38
+CND;
  39
+
  40
+        $session = $this->dm->getPhpcrSession();
  41
+        if (! $session instanceof \Jackalope\Session) {
  42
+            $this->markTestSkipped('Not a Jackalope session');
  43
+        }
  44
+        $ntm = $session->getWorkspace()->getNodeTypeManager();
  45
+        $ntm->registerNodeTypesCnd($cnd, true);
  46
+    }
  47
+
  48
+    /**
  49
+     * @see http://www.doctrine-project.org/jira/browse/PHPCR-78
  50
+     */
  51
+    public function testPersistDocumentReferenceAndProtectedProperty()
  52
+    { 
  53
+        $parent = new ProtectedPropertyTestObj();
  54
+        $parent->id = '/functional/pp';
  55
+        $parent->content = 'foo';
  56
+
  57
+        $this->dm->persist($parent);
  58
+        $this->dm->flush();
  59
+        $this->dm->clear();
  60
+    }
  61
+}
  62
+
  63
+/**
  64
+ * @PHPCRODM\Document(nodeType="test:protected_property_test")
  65
+ */
  66
+class ProtectedPropertyTestObj
  67
+{
  68
+    /** @PHPCRODM\Id() */
  69
+    public $id;
  70
+
  71
+    /** @PHPCRODM\ReferenceOne(strategy="hard") */
  72
+    public $reference;
  73
+
  74
+    /** @PHPCRODM\Date(name="jcr:created") */
  75
+    public $created;
  76
+
  77
+    /** @PHPCRODM\String(name="jcr:createdBy") */
  78
+    public $createdBy;
  79
+}

0 notes on commit a7e1ba8

Please sign in to comment.
Something went wrong with that request. Please try again.