Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / Ticket / DDC1757Test.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5 use Doctrine\ORM\UnitOfWork;
6
7 require_once __DIR__ . '/../../../TestInit.php';
8
9 class DDC1757Test extends \Doctrine\Tests\OrmFunctionalTestCase
10 {
11     public function testFailingCase()
12     {
13         $qb = $this->_em->createQueryBuilder();
14         /* @var $qb \Doctrine\ORM\QueryBuilder */
15
16         $qb->select('_a')
17             ->from(__NAMESPACE__ . '\DDC1757A', '_a')
18             ->from(__NAMESPACE__ . '\DDC1757B', '_b')
19             ->join('_b.c', '_c')
20             ->join('_c.d', '_d');
21
22         $q = $qb->getQuery();
23         $dql = $q->getDQL();
24
25         // Show difference between expected and actual queries on error
26         self::assertEquals("SELECT _a FROM " . __NAMESPACE__ . "\DDC1757A _a, " . __NAMESPACE__ . "\DDC1757B _b INNER JOIN _b.c _c INNER JOIN _c.d _d",
27                 $dql,
28                 "Wrong DQL query");
29     }
30 }
31
32 /**
33  * @Entity
34  */
35 class DDC1757A
36 {
37     /**
38      * @Column(type="integer")
39      * @Id
40      * @GeneratedValue(strategy="AUTO")
41      */
42     private $id;
43 }
44
45 /**
46  * @Entity
47  */
48 class DDC1757B
49 {
50     /**
51      * @Column(type="integer")
52      * @Id
53      * @GeneratedValue(strategy="AUTO")
54      */
55     private $id;
56
57     /**
58      * @OneToOne(targetEntity="DDC1757C")
59      */
60     private $c;
61 }
62
63 /**
64  * @Entity
65  */
66 class DDC1757C
67 {
68     /**
69      * @Column(type="integer")
70      * @Id
71      * @GeneratedValue(strategy="AUTO")
72      */
73     public $id;
74
75     /**
76      * @OneToOne(targetEntity="DDC1757D")
77      */
78     private $d;
79 }
80
81 /**
82  * @Entity
83  */
84 class DDC1757D
85 {
86     /**
87      * @Column(type="integer")
88      * @Id
89      * @GeneratedValue(strategy="AUTO")
90      */
91     public $id;
92 }