3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\Tests\Models\CMS\CmsUser;
7 use Doctrine\Tests\Models\CMS\CmsGroup;
9 require_once __DIR__ . '/../../../TestInit.php';
11 class DDC832Test extends \Doctrine\Tests\OrmFunctionalTestCase
13 public function setUp()
16 $platform = $this->_em->getConnection()->getDatabasePlatform();
17 if ($platform->getName() == "oracle") {
18 $this->markTestSkipped('Doesnt run on Oracle.');
21 $this->_em->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
23 $this->_schemaTool->createSchema(array(
24 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC832JoinedIndex'),
25 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC832JoinedTreeIndex'),
26 $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC832Like'),
28 } catch(\Exception $e) {
33 public function tearDown()
35 /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */
36 $platform = $this->_em->getConnection()->getDatabasePlatform();
37 $sm = $this->_em->getConnection()->getSchemaManager();
38 $sm->dropTable($platform->quoteIdentifier('TREE_INDEX'));
39 $sm->dropTable($platform->quoteIdentifier('INDEX'));
40 $sm->dropTable($platform->quoteIdentifier('LIKE'));
46 public function testQuotedTableBasicUpdate()
48 $like = new DDC832Like("test");
49 $this->_em->persist($like);
52 $like->word = "test2";
59 public function testQuotedTableBasicRemove()
61 $like = new DDC832Like("test");
62 $this->_em->persist($like);
65 $this->_em->remove($like);
72 public function testQuotedTableJoinedUpdate()
74 $index = new DDC832JoinedIndex("test");
75 $this->_em->persist($index);
78 $index->name = "asdf";
85 public function testQuotedTableJoinedRemove()
87 $index = new DDC832JoinedIndex("test");
88 $this->_em->persist($index);
91 $this->_em->remove($index);
98 public function testQuotedTableJoinedChildUpdate()
100 $index = new DDC832JoinedTreeIndex("test", 1, 2);
101 $this->_em->persist($index);
104 $index->name = "asdf";
111 public function testQuotedTableJoinedChildRemove()
113 $index = new DDC832JoinedTreeIndex("test", 1, 2);
114 $this->_em->persist($index);
117 $this->_em->remove($index);
124 * @Table(name="`LIKE`")
129 * @Id @Column(type="integer") @GeneratedValue
133 /** @Column(type="string") */
138 * @Column(type="integer")
142 public function __construct($word)
150 * @Table(name="`INDEX`")
151 * @InheritanceType("JOINED")
152 * @DiscriminatorColumn(name="discr", type="string")
153 * @DiscriminatorMap({"like" = "DDC832JoinedIndex", "fuzzy" = "DDC832JoinedTreeIndex"})
155 class DDC832JoinedIndex
158 * @Id @Column(type="integer") @GeneratedValue
162 /** @Column(type="string") */
167 * @Column(type="integer")
171 public function __construct($name)
179 * @Table(name="`TREE_INDEX`")
181 class DDC832JoinedTreeIndex extends DDC832JoinedIndex
183 /** @Column(type="integer") */
185 /** @Column(type="integer") */
188 public function __construct($name, $lft, $rgt)