This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace TheCodingMachine\FluidSchema; |
||
4 | |||
5 | use Doctrine\DBAL\Schema\Schema; |
||
6 | use Doctrine\DBAL\Types\Type; |
||
7 | use PHPUnit\Framework\TestCase; |
||
8 | |||
9 | class TdbmFluidTableTest extends TestCase |
||
10 | { |
||
11 | View Code Duplication | public function testColumn() |
|
12 | { |
||
13 | $schema = new Schema(); |
||
14 | $fluid = new TdbmFluidSchema($schema); |
||
15 | |||
16 | $posts = $fluid->table('posts'); |
||
17 | |||
18 | $column = $posts->column('foo'); |
||
19 | |||
20 | $this->assertTrue($schema->getTable('posts')->hasColumn('foo')); |
||
21 | |||
22 | $this->assertSame($column, $posts->column('foo'), 'Failed asserting that the same instance is returned.'); |
||
23 | } |
||
24 | |||
25 | public function testExistingColumn() |
||
26 | { |
||
27 | $schema = new Schema(); |
||
28 | $postsSchemaTable = $schema->createTable('posts'); |
||
29 | $postsSchemaTable->addColumn('foo', 'string'); |
||
30 | $fluid = new TdbmFluidSchema($schema); |
||
31 | |||
32 | $posts = $fluid->table('posts'); |
||
33 | |||
34 | $posts->column('foo')->integer(); |
||
35 | |||
36 | $this->assertSame(Type::getType(Type::INTEGER), $schema->getTable('posts')->getColumn('foo')->getType()); |
||
0 ignored issues
–
show
|
|||
37 | } |
||
38 | |||
39 | public function testIndex() |
||
40 | { |
||
41 | $schema = new Schema(); |
||
42 | $fluid = new TdbmFluidSchema($schema); |
||
43 | |||
44 | $posts = $fluid->table('posts'); |
||
45 | |||
46 | $posts->column('foo')->integer()->then()->index(['foo']); |
||
47 | |||
48 | $this->assertCount(1, $schema->getTable('posts')->getIndexes()); |
||
0 ignored issues
–
show
$schema->getTable('posts')->getIndexes() is of type array<integer,object<Doctrine\DBAL\Schema\Index>> , but the function expects a object<Countable>|object...nit\Framework\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
49 | } |
||
50 | |||
51 | public function testUnique() |
||
52 | { |
||
53 | $schema = new Schema(); |
||
54 | $fluid = new TdbmFluidSchema($schema); |
||
55 | |||
56 | $posts = $fluid->table('posts'); |
||
57 | |||
58 | $posts->column('foo')->integer()->then()->unique(['foo']); |
||
59 | |||
60 | $this->assertCount(1, $schema->getTable('posts')->getIndexes()); |
||
0 ignored issues
–
show
$schema->getTable('posts')->getIndexes() is of type array<integer,object<Doctrine\DBAL\Schema\Index>> , but the function expects a object<Countable>|object...nit\Framework\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
61 | } |
||
62 | |||
63 | View Code Duplication | 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 | { |
||
78 | $schema = new Schema(); |
||
79 | $fluid = new TdbmFluidSchema($schema); |
||
80 | |||
81 | $posts = $fluid->table('posts'); |
||
82 | |||
83 | $posts->id(); |
||
84 | |||
85 | $this->assertTrue($schema->getTable('posts')->hasPrimaryKey()); |
||
86 | $this->assertTrue($schema->getTable('posts')->hasColumn('id')); |
||
87 | } |
||
88 | |||
89 | View Code Duplication | 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 | { |
||
105 | $schema = new Schema(); |
||
106 | $fluid = new TdbmFluidSchema($schema); |
||
107 | |||
108 | $posts = $fluid->table('posts'); |
||
109 | |||
110 | $this->expectException(FluidSchemaException::class); |
||
111 | $posts->uuid('v2'); |
||
112 | } |
||
113 | |||
114 | public function testCustomBeanName() |
||
115 | { |
||
116 | $schema = new Schema(); |
||
117 | $fluid = new TdbmFluidSchema($schema); |
||
118 | |||
119 | $posts = $fluid->table('posts'); |
||
120 | |||
121 | $posts->customBeanName('Article'); |
||
122 | |||
123 | $this->assertSame("\n@Bean(name = \"Article\")", $schema->getTable('posts')->getOptions()['comment']); |
||
124 | } |
||
125 | |||
126 | View Code Duplication | public function testImplementsInterface() |
|
127 | { |
||
128 | $schema = new Schema(); |
||
129 | $fluid = new TdbmFluidSchema($schema); |
||
130 | |||
131 | $posts = $fluid->table('posts'); |
||
132 | |||
133 | $posts->implementsInterface('Foo\\Bar'); |
||
134 | $posts->implementsInterface('Foo\\Bar2'); |
||
135 | |||
136 | $this->assertSame("\n@AddInterface(name = \"Foo\\Bar\")\n@AddInterface(name = \"Foo\\Bar2\")", $schema->getTable('posts')->getOptions()['comment']); |
||
137 | } |
||
138 | |||
139 | public function testImplementsInterfaceOnDao() |
||
140 | { |
||
141 | $schema = new Schema(); |
||
142 | $fluid = new TdbmFluidSchema($schema); |
||
143 | |||
144 | $posts = $fluid->table('posts'); |
||
145 | |||
146 | $posts->implementsInterfaceOnDao('Foo\\Bar'); |
||
147 | |||
148 | $this->assertSame("\n@AddInterfaceOnDao(name = \"Foo\\Bar\")", $schema->getTable('posts')->getOptions()['comment']); |
||
149 | } |
||
150 | |||
151 | View Code Duplication | public function testUseTrait() |
|
152 | { |
||
153 | $schema = new Schema(); |
||
154 | $fluid = new TdbmFluidSchema($schema); |
||
155 | |||
156 | $posts = $fluid->table('posts'); |
||
157 | |||
158 | $posts->useTrait('Foo\\Bar'); |
||
159 | $posts->useTrait('Foo\\Bar2'); |
||
160 | |||
161 | $this->assertSame("\n@AddTrait(name = \"Foo\\Bar\", modifiers = {})\n@AddTrait(name = \"Foo\\Bar2\", modifiers = {})", $schema->getTable('posts')->getOptions()['comment']); |
||
162 | } |
||
163 | |||
164 | public function testUseTraitOnDao() |
||
165 | { |
||
166 | $schema = new Schema(); |
||
167 | $fluid = new TdbmFluidSchema($schema); |
||
168 | |||
169 | $posts = $fluid->table('posts'); |
||
170 | |||
171 | $posts->useTraitOnDao('Foo\\Bar'); |
||
172 | |||
173 | $this->assertSame("\n@AddTraitOnDao(name = \"Foo\\Bar\", modifiers = {})", $schema->getTable('posts')->getOptions()['comment']); |
||
174 | } |
||
175 | |||
176 | View Code Duplication | 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 | View Code Duplication | public function testInherits() |
|
194 | { |
||
195 | $schema = new Schema(); |
||
196 | $fluid = new TdbmFluidSchema($schema); |
||
197 | |||
198 | $contacts = $fluid->table('contacts'); |
||
199 | $contacts->id(); |
||
200 | |||
201 | $fluid->table('users')->extends('contacts'); |
||
202 | |||
203 | $dbalColumn = $schema->getTable('users')->getColumn('id'); |
||
204 | |||
205 | $this->assertSame(Type::getType(Type::INTEGER), $dbalColumn->getType()); |
||
0 ignored issues
–
show
The constant
Doctrine\DBAL\Types\Type::INTEGER has been deprecated with message: Use {@see DefaultTypes::INTEGER} instead.
This class constant has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead. ![]() |
|||
206 | $fks = $schema->getTable('users')->getForeignKeys(); |
||
207 | $this->assertCount(1, $fks); |
||
0 ignored issues
–
show
$fks is of type array<integer,object<Doc...\ForeignKeyConstraint>> , but the function expects a object<Countable>|object...nit\Framework\iterable> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
208 | $fk = array_pop($fks); |
||
209 | $this->assertSame('users', $fk->getLocalTableName()); |
||
210 | $this->assertSame('contacts', $fk->getForeignTableName()); |
||
211 | $this->assertSame(['id'], $fk->getLocalColumns()); |
||
212 | } |
||
213 | |||
214 | public function testGetDbalTable() |
||
215 | { |
||
216 | $schema = new Schema(); |
||
217 | $fluid = new TdbmFluidSchema($schema); |
||
218 | |||
219 | $contacts = $fluid->table('contacts'); |
||
220 | $this->assertSame('contacts', $contacts->getDbalTable()->getName()); |
||
221 | } |
||
222 | } |
||
223 |
This class constant has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.