Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / Ticket / DDC1454Test.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 /**
10  * @group DDC-1454
11  */
12 class DDC1454Test extends \Doctrine\Tests\OrmFunctionalTestCase
13 {
14     protected function setUp()
15     {
16         parent::setUp();
17
18         try {
19             $this->_schemaTool->createSchema(array(
20                 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454File'),
21                 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1454Picture'),
22             ));
23         } catch (\Exception $ignored) {
24
25         }
26     }
27
28     public function testFailingCase()
29     {
30         $pic = new DDC1454Picture();
31         $this->_em->getUnitOfWork()->getEntityState($pic);
32     }
33
34 }
35
36 /**
37  * @Entity
38  */
39 class DDC1454Picture extends DDC1454File
40 {
41
42 }
43
44 /**
45  * @Entity
46  * @InheritanceType("JOINED")
47  * @DiscriminatorColumn(name="discr", type="string")
48  * @DiscriminatorMap({"picture" = "DDC1454Picture"})
49  */
50 class DDC1454File
51 {
52     /**
53      * @Column(name="file_id", type="integer")
54      * @Id
55      */
56     public $fileId;
57
58     public function __construct() {
59         $this->fileId = rand();
60     }
61
62     /**
63      * Get fileId
64      */
65     public function getFileId() {
66         return $this->fileId;
67     }
68
69 }