Permalink
Browse files

adding mapping functional test about inheritance breaking after 1st l…

…evel. this test should be extended to cover all mapping options with all mapping methods (see PHPCR-42)
  • Loading branch information...
1 parent 9556fc7 commit 38f8bbc8b655aafd099287e18401248c44b40492 @dbu dbu committed Feb 13, 2012
Showing with 77 additions and 0 deletions.
  1. +77 −0 tests/Doctrine/Tests/ODM/PHPCR/Functional/Mapping/AnnotationMappingTest.php
@@ -0,0 +1,77 @@
+<?php
+
+namespace Doctrine\Tests\ODM\PHPCR\Functional;
+
+use Doctrine\ODM\PHPCR\Id\RepositoryIdInterface,
+ Doctrine\ODM\PHPCR\DocumentRepository,
+ Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
+
+/**
+ * @group functional
+ */
+class MappingTest extends \Doctrine\Tests\ODM\PHPCR\PHPCRFunctionalTestCase
+{
+ /**
+ * @var DocumentManager
+ */
+ private $dm;
+
+ private $type;
+
+ private $node;
+
+ public function setUp()
+ {
+ $this->dm = $this->createDocumentManager(array(__DIR__));
+ $this->node = $this->resetFunctionalNode($this->dm);
+ }
+
+ public function testAnnotationInheritance()
+ {
+ $extending = new ExtendingClass();
+ $extending->id = '/functional/extending';
+ $this->dm->persist($extending);
+ }
+ public function testSecondLevelInheritance()
+ {
+ $second = new SecondLevel();
+ $second->id = '/functional/second';
+ $this->dm->persist($second);
+ }
+
+ // TODO comprehensive test for all possible mapped fields in an abstract test, trying to persist and check if properly set
+ // then dm->clear and check if still properly set.
+
+ // then a test per mapping implementation extending the abstract test and providing documents with the mapping
+}
+
+/**
+ * @PHPCRODM\Document()
+ */
+class Testclass
+{
+ /** @PHPCRODM\Id */
+ public $id;
+ /** @PHPCRODM\Node */
+ public $node;
+ /** @PHPCRODM\String */
+ public $username;
+ /** @PHPCRODM\Int(name="numbers", multivalue=true) */
+ public $numbers;
+}
+
+/**
+ * @PHPCRODM\Document()
+ */
+class ExtendingClass extends Testclass
+{
+ /** @PHPCRODM\String */
+ public $username;
+}
+
+/**
+ * @PHPCRODM\Document()
+ */
+class SecondLevel extends ExtendingClass
+{
+}

0 comments on commit 38f8bbc

Please sign in to comment.