Permalink
Browse files

Added coverage to DDC-1587.

  • Loading branch information...
1 parent fdb2b9c commit 0f070448367f90dffb81225c680ef9b3490a3f0a @guilhermeblanco guilhermeblanco committed Jan 17, 2012
Showing with 67 additions and 0 deletions.
  1. +67 −0 tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php
@@ -109,6 +109,19 @@ public function testInvalidToOneJoinColumnSchema()
$ce
);
}
+
+ /**
+ * @group DDC-1587
+ */
+ public function testValidOneToOneAsIdentifierSchema()
+ {
+ $class1 = $this->em->getClassMetadata(__NAMESPACE__ . '\DDC1587ValidEntity2');
+ $class2 = $this->em->getClassMetadata(__NAMESPACE__ . '\DDC1587ValidEntity1');
+
+ $ce = $this->validator->validateClass($class1);
+
+ $this->assertEquals(array(), $ce);
+ }
}
/**
@@ -154,3 +167,57 @@ class InvalidEntity2
*/
protected $assoc;
}
+
+/**
+ * @Entity(repositoryClass="Entity\Repository\Agent")
+ * @Table(name="agent")
+ */
+class DDC1587ValidEntity1
+{
+ /**
+ * @var int
+ *
+ * @Id @GeneratedValue
+ * @Column(name="pk", type="integer")
+ */
+ private $pk;
+
+ /**
+ * @var string
+ *
+ * @Column(name="name", type="string", length=32)
+ */
+ private $name;
+
+ /**
+ * @var Identifier
+ *
+ * @OneToOne(targetEntity="DDC1587ValidEntity2", cascade={"all"}, mappedBy="agent")
+ * @JoinColumn(name="pk", referencedColumnName="pk_agent")
+ */
+ private $identifier;
+}
+
+/**
+ * @Entity
+ * @Table
+ */
+class DDC1587ValidEntity2
+{
+ /**
+ * @var DDC1587ValidEntity1
+ *
+ * @Id
+ * @OneToOne(targetEntity="DDC1587ValidEntity1", inversedBy="identifier")
+ * @JoinColumn(name="pk_agent", referencedColumnName="pk", nullable=false)
+ */
+ private $agent;
+
+ /**
+ * @var string
+ *
+ * @Column(name="num", type="string", length=16, nullable=true)
+ */
+ private $num;
+}
+

0 comments on commit 0f07044

Please sign in to comment.