@@ 63-74 (lines=12) @@ | ||
60 | $this->assertCount(1, $schema->getTable('posts')->getIndexes()); |
|
61 | } |
|
62 | ||
63 | public function testPrimaryKey() |
|
64 | { |
|
65 | $schema = new Schema(); |
|
66 | $fluid = new TdbmFluidSchema($schema); |
|
67 | ||
68 | $posts = $fluid->table('posts'); |
|
69 | ||
70 | $posts->column('id')->integer()->then()->primaryKey(['id'], 'pkname'); |
|
71 | ||
72 | $this->assertTrue($schema->getTable('posts')->hasPrimaryKey()); |
|
73 | $this->assertTrue($schema->getTable('posts')->hasIndex('pkname')); |
|
74 | } |
|
75 | ||
76 | public function testId() |
|
77 | { |
|
@@ 89-101 (lines=13) @@ | ||
86 | $this->assertTrue($schema->getTable('posts')->hasColumn('id')); |
|
87 | } |
|
88 | ||
89 | public function testUuid() |
|
90 | { |
|
91 | $schema = new Schema(); |
|
92 | $fluid = new TdbmFluidSchema($schema); |
|
93 | ||
94 | $posts = $fluid->table('posts'); |
|
95 | ||
96 | $posts->uuid(); |
|
97 | ||
98 | $this->assertTrue($schema->getTable('posts')->hasPrimaryKey()); |
|
99 | $this->assertTrue($schema->getTable('posts')->hasColumn('uuid')); |
|
100 | $this->assertSame("\n@UUID(\"v4\")", $schema->getTable('posts')->getColumn('uuid')->getComment()); |
|
101 | } |
|
102 | ||
103 | public function testUuidBadType() |
|
104 | { |
|
@@ 176-191 (lines=16) @@ | ||
173 | $this->assertSame("\n@AddTraitOnDao(name = \"Foo\\Bar\", modifiers = {})", $schema->getTable('posts')->getOptions()['comment']); |
|
174 | } |
|
175 | ||
176 | public function testTimestamps() |
|
177 | { |
|
178 | if (defined('Doctrine\\DBAL\\Types\\Type::DATE_IMMUTABLE')) { |
|
179 | $schema = new Schema(); |
|
180 | $fluid = new TdbmFluidSchema($schema); |
|
181 | ||
182 | $posts = $fluid->table('posts'); |
|
183 | ||
184 | $posts->timestamps(); |
|
185 | ||
186 | $this->assertTrue($schema->getTable('posts')->hasColumn('created_at')); |
|
187 | $this->assertTrue($schema->getTable('posts')->hasColumn('updated_at')); |
|
188 | } else { |
|
189 | $this->markTestSkipped("Only available from Doctrine DBAL 2.6"); |
|
190 | } |
|
191 | } |
|
192 | ||
193 | public function testInherits() |
|
194 | { |
@@ 68-79 (lines=12) @@ | ||
65 | $this->assertCount(1, $schema->getTable('posts')->getIndexes()); |
|
66 | } |
|
67 | ||
68 | public function testPrimaryKey() |
|
69 | { |
|
70 | $schema = new Schema(); |
|
71 | $fluid = new TdbmFluidSchema($schema); |
|
72 | ||
73 | $posts = $fluid->table('posts'); |
|
74 | ||
75 | $posts->column('id')->integer()->primaryKey('pkname'); |
|
76 | ||
77 | $this->assertTrue($schema->getTable('posts')->hasPrimaryKey()); |
|
78 | $this->assertTrue($schema->getTable('posts')->hasIndex('pkname')); |
|
79 | } |
|
80 | } |
|
81 |