HexMakina /
Crudites
| 1 | <?php |
||
| 2 | use PHPUnit\Framework\TestCase; |
||
| 3 | use HexMakina\Crudites\Connection; |
||
| 4 | use HexMakina\Crudites\Schema\Schema; |
||
| 5 | use HexMakina\Crudites\Schema\SchemaAttribute; |
||
| 6 | use HexMakina\BlackBox\Database\SchemaAttributeInterface; |
||
|
0 ignored issues
–
show
|
|||
| 7 | |||
| 8 | |||
| 9 | class SchemaAttributeTest extends TestCase |
||
| 10 | { |
||
| 11 | private Connection $connection; |
||
| 12 | private Schema $schema; |
||
| 13 | // setup |
||
| 14 | public function setUp(): void |
||
| 15 | { |
||
| 16 | // code to execute before each test |
||
| 17 | |||
| 18 | $dsn = 'mysql:host=localhost;dbname=crudites;charset=utf8'; |
||
| 19 | $this->connection = new Connection($dsn, 'root', 'changeme0'); |
||
| 20 | $this->schema = $this->connection->schema(); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testAttributesForNonExistentColumn() |
||
| 24 | { |
||
| 25 | $this->expectException(\InvalidArgumentException::class); |
||
| 26 | $this->expectExceptionMessage('CANNOT FIND COLUMN description IN TABLE products'); |
||
| 27 | $attributes = $this->schema->attributes('products', 'description'); |
||
|
0 ignored issues
–
show
|
|||
| 28 | } |
||
| 29 | |||
| 30 | public function testAttributesForUserId() |
||
| 31 | { |
||
| 32 | $attributes = $this->schema->attributes('users', 'id'); |
||
| 33 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 34 | $this->assertFalse($attributes->nullable()); |
||
| 35 | $this->assertNull($attributes->default()); |
||
| 36 | |||
| 37 | $this->assertNull($attributes->length()); |
||
| 38 | |||
| 39 | $this->assertEquals($attributes->precision(), 10); |
||
| 40 | $this->assertEquals($attributes->scale(), 0); |
||
| 41 | |||
| 42 | $this->assertIsArray($attributes->enums()); |
||
| 43 | $this->assertEmpty($attributes->enums()); |
||
| 44 | |||
| 45 | $this->assertEquals($attributes->type(), SchemaAttributeInterface::TYPE_INTEGER); |
||
| 46 | |||
| 47 | $this->assertTrue($attributes->isAuto()); |
||
| 48 | } |
||
| 49 | |||
| 50 | public function testAttributesForOrderStatus() |
||
| 51 | { |
||
| 52 | $attributes = $this->schema->attributes('orders', 'status'); |
||
| 53 | |||
| 54 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 55 | |||
| 56 | $this->assertTrue($attributes->nullable()); |
||
| 57 | $this->assertFalse($attributes->isAuto()); |
||
| 58 | |||
| 59 | $this->assertEquals($attributes->type(), SchemaAttributeInterface::TYPE_ENUM); |
||
| 60 | $this->assertEquals($attributes->default(), 'pending'); |
||
| 61 | |||
| 62 | $this->assertEquals($attributes->length(), 9); |
||
| 63 | |||
| 64 | $this->assertNull($attributes->precision()); |
||
| 65 | $this->assertEquals($attributes->scale(), 0); |
||
| 66 | |||
| 67 | $this->assertIsArray($attributes->enums()); |
||
| 68 | $this->assertEquals($attributes->enums(), ['pending', 'completed', 'cancelled']); |
||
| 69 | } |
||
| 70 | |||
| 71 | public function testAttributesForProductPrice() |
||
| 72 | { |
||
| 73 | $attributes = $this->schema->attributes('products', 'price'); |
||
| 74 | |||
| 75 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 76 | |||
| 77 | $this->assertFalse($attributes->nullable()); |
||
| 78 | $this->assertNull($attributes->default()); |
||
| 79 | |||
| 80 | $this->assertNull($attributes->length()); |
||
| 81 | |||
| 82 | $this->assertEquals($attributes->precision(), 10); |
||
| 83 | $this->assertEquals($attributes->scale(), 2); |
||
| 84 | |||
| 85 | $this->assertIsArray($attributes->enums()); |
||
| 86 | $this->assertEmpty($attributes->enums()); |
||
| 87 | |||
| 88 | $this->assertEquals($attributes->type(), SchemaAttributeInterface::TYPE_DECIMAL); |
||
| 89 | |||
| 90 | $this->assertFalse($attributes->isAuto()); |
||
| 91 | } |
||
| 92 | |||
| 93 | public function testAttributesForProductCategory() |
||
| 94 | { |
||
| 95 | $attributes = $this->schema->attributes('products', 'category'); |
||
| 96 | |||
| 97 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 98 | |||
| 99 | $this->assertFalse($attributes->nullable()); |
||
| 100 | $this->assertNull($attributes->default()); |
||
| 101 | |||
| 102 | $this->assertEquals($attributes->length(), 100); |
||
| 103 | |||
| 104 | $this->assertNull($attributes->precision()); |
||
| 105 | $this->assertEquals($attributes->scale(), 0); |
||
| 106 | |||
| 107 | $this->assertIsArray($attributes->enums()); |
||
| 108 | $this->assertEmpty($attributes->enums()); |
||
| 109 | |||
| 110 | $this->assertEquals(SchemaAttributeInterface::TYPE_STRING, $attributes->type()); |
||
| 111 | |||
| 112 | $this->assertFalse($attributes->isAuto()); |
||
| 113 | } |
||
| 114 | |||
| 115 | public function testAttributeForDataTypeTableTinyInt() |
||
| 116 | { |
||
| 117 | $attributes = $this->schema->attributes('data_types_table', 'tinyint'); |
||
| 118 | |||
| 119 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 120 | |||
| 121 | $this->assertTrue($attributes->nullable()); |
||
| 122 | $this->assertNull($attributes->default()); |
||
| 123 | |||
| 124 | $this->assertNull($attributes->length()); |
||
| 125 | |||
| 126 | $this->assertEquals($attributes->precision(), 3); |
||
| 127 | $this->assertEquals($attributes->scale(), 0); |
||
| 128 | |||
| 129 | $this->assertIsArray($attributes->enums()); |
||
| 130 | $this->assertEmpty($attributes->enums()); |
||
| 131 | |||
| 132 | $this->assertEquals(SchemaAttributeInterface::TYPE_INTEGER, $attributes->type()); |
||
| 133 | |||
| 134 | $this->assertFalse($attributes->isAuto()); |
||
| 135 | } |
||
| 136 | |||
| 137 | public function testAttributeForDataTypeTableSmallInt() |
||
| 138 | { |
||
| 139 | $attributes = $this->schema->attributes('data_types_table', 'smallint'); |
||
| 140 | |||
| 141 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 142 | |||
| 143 | $this->assertTrue($attributes->nullable()); |
||
| 144 | $this->assertNull($attributes->default()); |
||
| 145 | |||
| 146 | $this->assertNull($attributes->length()); |
||
| 147 | |||
| 148 | $this->assertEquals($attributes->precision(), 5); |
||
| 149 | $this->assertEquals($attributes->scale(), 0); |
||
| 150 | |||
| 151 | $this->assertIsArray($attributes->enums()); |
||
| 152 | $this->assertEmpty($attributes->enums()); |
||
| 153 | |||
| 154 | $this->assertEquals(SchemaAttributeInterface::TYPE_INTEGER, $attributes->type()); |
||
| 155 | |||
| 156 | $this->assertFalse($attributes->isAuto()); |
||
| 157 | } |
||
| 158 | |||
| 159 | public function testAttributeForDataTypeTableMediumInt() |
||
| 160 | { |
||
| 161 | $attributes = $this->schema->attributes('data_types_table', 'mediumint'); |
||
| 162 | |||
| 163 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 164 | |||
| 165 | $this->assertTrue($attributes->nullable()); |
||
| 166 | $this->assertNull($attributes->default()); |
||
| 167 | |||
| 168 | $this->assertNull($attributes->length()); |
||
| 169 | |||
| 170 | $this->assertEquals($attributes->precision(), 7); |
||
| 171 | $this->assertEquals($attributes->scale(), 0); |
||
| 172 | |||
| 173 | $this->assertIsArray($attributes->enums()); |
||
| 174 | $this->assertEmpty($attributes->enums()); |
||
| 175 | |||
| 176 | $this->assertEquals(SchemaAttributeInterface::TYPE_INTEGER, $attributes->type()); |
||
| 177 | |||
| 178 | $this->assertFalse($attributes->isAuto()); |
||
| 179 | } |
||
| 180 | |||
| 181 | public function testAttributeForDataTypeTableInt() |
||
| 182 | { |
||
| 183 | $attributes = $this->schema->attributes('data_types_table', 'int'); |
||
| 184 | |||
| 185 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 186 | |||
| 187 | $this->assertTrue($attributes->nullable()); |
||
| 188 | $this->assertNull($attributes->default()); |
||
| 189 | |||
| 190 | $this->assertNull($attributes->length()); |
||
| 191 | |||
| 192 | $this->assertEquals($attributes->precision(), 10); |
||
| 193 | $this->assertEquals($attributes->scale(), 0); |
||
| 194 | |||
| 195 | $this->assertIsArray($attributes->enums()); |
||
| 196 | $this->assertEmpty($attributes->enums()); |
||
| 197 | |||
| 198 | $this->assertEquals(SchemaAttributeInterface::TYPE_INTEGER, $attributes->type()); |
||
| 199 | |||
| 200 | $this->assertFalse($attributes->isAuto()); |
||
| 201 | } |
||
| 202 | |||
| 203 | public function testAttributeForDataTypeTableBigInt() |
||
| 204 | { |
||
| 205 | $attributes = $this->schema->attributes('data_types_table', 'bigint'); |
||
| 206 | |||
| 207 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 208 | |||
| 209 | $this->assertTrue($attributes->nullable()); |
||
| 210 | $this->assertNull($attributes->default()); |
||
| 211 | |||
| 212 | $this->assertNull($attributes->length()); |
||
| 213 | |||
| 214 | $this->assertEquals($attributes->precision(), 19); |
||
| 215 | $this->assertEquals($attributes->scale(), 0); |
||
| 216 | |||
| 217 | $this->assertIsArray($attributes->enums()); |
||
| 218 | $this->assertEmpty($attributes->enums()); |
||
| 219 | |||
| 220 | $this->assertEquals(SchemaAttributeInterface::TYPE_INTEGER, $attributes->type()); |
||
| 221 | |||
| 222 | $this->assertFalse($attributes->isAuto()); |
||
| 223 | } |
||
| 224 | |||
| 225 | public function testAttributeForDataTypeTableFloat() |
||
| 226 | { |
||
| 227 | $attributes = $this->schema->attributes('data_types_table', 'float'); |
||
| 228 | |||
| 229 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 230 | |||
| 231 | $this->assertTrue($attributes->nullable()); |
||
| 232 | $this->assertNull($attributes->default()); |
||
| 233 | |||
| 234 | $this->assertNull($attributes->length()); |
||
| 235 | |||
| 236 | $this->assertEquals($attributes->precision(), 12); |
||
| 237 | $this->assertNull($attributes->scale()); |
||
| 238 | |||
| 239 | $this->assertIsArray($attributes->enums()); |
||
| 240 | $this->assertEmpty($attributes->enums()); |
||
| 241 | |||
| 242 | $this->assertEquals(SchemaAttributeInterface::TYPE_FLOAT, $attributes->type()); |
||
| 243 | |||
| 244 | $this->assertFalse($attributes->isAuto()); |
||
| 245 | } |
||
| 246 | |||
| 247 | public function testAttributeForDataTypeTableDouble() |
||
| 248 | { |
||
| 249 | $attributes = $this->schema->attributes('data_types_table', 'double'); |
||
| 250 | |||
| 251 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 252 | |||
| 253 | $this->assertTrue($attributes->nullable()); |
||
| 254 | $this->assertNull($attributes->default()); |
||
| 255 | |||
| 256 | $this->assertNull($attributes->length()); |
||
| 257 | |||
| 258 | $this->assertEquals($attributes->precision(), 22); |
||
| 259 | $this->assertNull($attributes->scale()); |
||
| 260 | |||
| 261 | $this->assertIsArray($attributes->enums()); |
||
| 262 | $this->assertEmpty($attributes->enums()); |
||
| 263 | |||
| 264 | $this->assertEquals(SchemaAttributeInterface::TYPE_FLOAT, $attributes->type()); |
||
| 265 | |||
| 266 | $this->assertFalse($attributes->isAuto()); |
||
| 267 | } |
||
| 268 | |||
| 269 | public function testAttributeForDataTypeTableDecimal() |
||
| 270 | { |
||
| 271 | $attributes = $this->schema->attributes('data_types_table', 'decimal'); |
||
| 272 | |||
| 273 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 274 | |||
| 275 | $this->assertTrue($attributes->nullable()); |
||
| 276 | $this->assertNull($attributes->default()); |
||
| 277 | |||
| 278 | $this->assertNull($attributes->length()); |
||
| 279 | |||
| 280 | $this->assertEquals($attributes->precision(), 10); |
||
| 281 | $this->assertEquals($attributes->scale(), 2); |
||
| 282 | |||
| 283 | $this->assertIsArray($attributes->enums()); |
||
| 284 | $this->assertEmpty($attributes->enums()); |
||
| 285 | |||
| 286 | $this->assertEquals(SchemaAttributeInterface::TYPE_DECIMAL, $attributes->type()); |
||
| 287 | |||
| 288 | $this->assertFalse($attributes->isAuto()); |
||
| 289 | } |
||
| 290 | |||
| 291 | public function testAttributeForDataTypeTableChar() |
||
| 292 | { |
||
| 293 | $attributes = $this->schema->attributes('data_types_table', 'char'); |
||
| 294 | |||
| 295 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 296 | |||
| 297 | $this->assertTrue($attributes->nullable()); |
||
| 298 | $this->assertNull($attributes->default()); |
||
| 299 | |||
| 300 | $this->assertEquals($attributes->length(), 10); |
||
| 301 | |||
| 302 | $this->assertNull($attributes->precision()); |
||
| 303 | $this->assertEquals($attributes->scale(), 0); |
||
| 304 | |||
| 305 | $this->assertIsArray($attributes->enums()); |
||
| 306 | $this->assertEmpty($attributes->enums()); |
||
| 307 | |||
| 308 | $this->assertEquals(SchemaAttributeInterface::TYPE_STRING, $attributes->type()); |
||
| 309 | |||
| 310 | $this->assertFalse($attributes->isAuto()); |
||
| 311 | } |
||
| 312 | |||
| 313 | public function testAttributeForDataTypeTableVarchar() |
||
| 314 | { |
||
| 315 | $attributes = $this->schema->attributes('data_types_table', 'varchar'); |
||
| 316 | |||
| 317 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 318 | |||
| 319 | $this->assertTrue($attributes->nullable()); |
||
| 320 | $this->assertNull($attributes->default()); |
||
| 321 | |||
| 322 | $this->assertEquals($attributes->length(), 255); |
||
| 323 | |||
| 324 | $this->assertNull($attributes->precision()); |
||
| 325 | $this->assertEquals($attributes->scale(), 0); |
||
| 326 | |||
| 327 | $this->assertIsArray($attributes->enums()); |
||
| 328 | $this->assertEmpty($attributes->enums()); |
||
| 329 | |||
| 330 | $this->assertEquals(SchemaAttributeInterface::TYPE_STRING, $attributes->type()); |
||
| 331 | |||
| 332 | $this->assertFalse($attributes->isAuto()); |
||
| 333 | } |
||
| 334 | |||
| 335 | public function testAttributeForDataTypeTableText() |
||
| 336 | { |
||
| 337 | $attributes = $this->schema->attributes('data_types_table', 'text'); |
||
| 338 | |||
| 339 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 340 | |||
| 341 | $this->assertTrue($attributes->nullable()); |
||
| 342 | $this->assertNull($attributes->default()); |
||
| 343 | |||
| 344 | $this->assertEquals($attributes->length(), 65535); |
||
| 345 | |||
| 346 | $this->assertNull($attributes->precision()); |
||
| 347 | $this->assertEquals($attributes->scale(), 0); |
||
| 348 | |||
| 349 | $this->assertIsArray($attributes->enums()); |
||
| 350 | $this->assertEmpty($attributes->enums()); |
||
| 351 | |||
| 352 | $this->assertEquals(SchemaAttributeInterface::TYPE_TEXT, $attributes->type()); |
||
| 353 | |||
| 354 | $this->assertFalse($attributes->isAuto()); |
||
| 355 | } |
||
| 356 | |||
| 357 | public function testAttributeForDataTypeTableTinyText() |
||
| 358 | { |
||
| 359 | $attributes = $this->schema->attributes('data_types_table', 'tinytext'); |
||
| 360 | |||
| 361 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 362 | |||
| 363 | $this->assertTrue($attributes->nullable()); |
||
| 364 | $this->assertNull($attributes->default()); |
||
| 365 | |||
| 366 | $this->assertEquals($attributes->length(), 255); |
||
| 367 | |||
| 368 | $this->assertNull($attributes->precision()); |
||
| 369 | $this->assertEquals($attributes->scale(), 0); |
||
| 370 | |||
| 371 | $this->assertIsArray($attributes->enums()); |
||
| 372 | $this->assertEmpty($attributes->enums()); |
||
| 373 | |||
| 374 | $this->assertEquals(SchemaAttributeInterface::TYPE_TEXT, $attributes->type()); |
||
| 375 | |||
| 376 | $this->assertFalse($attributes->isAuto()); |
||
| 377 | } |
||
| 378 | |||
| 379 | public function testAttributeForDataTypeTableMediumText() |
||
| 380 | { |
||
| 381 | $attributes = $this->schema->attributes('data_types_table', 'mediumtext'); |
||
| 382 | |||
| 383 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 384 | |||
| 385 | $this->assertTrue($attributes->nullable()); |
||
| 386 | $this->assertNull($attributes->default()); |
||
| 387 | |||
| 388 | $this->assertEquals($attributes->length(), 16777215); |
||
| 389 | |||
| 390 | $this->assertNull($attributes->precision()); |
||
| 391 | $this->assertEquals($attributes->scale(), 0); |
||
| 392 | |||
| 393 | $this->assertIsArray($attributes->enums()); |
||
| 394 | $this->assertEmpty($attributes->enums()); |
||
| 395 | |||
| 396 | $this->assertEquals(SchemaAttributeInterface::TYPE_TEXT, $attributes->type()); |
||
| 397 | |||
| 398 | $this->assertFalse($attributes->isAuto()); |
||
| 399 | } |
||
| 400 | |||
| 401 | public function testAttributeForDataTypeTableLongText() |
||
| 402 | { |
||
| 403 | $attributes = $this->schema->attributes('data_types_table', 'longtext'); |
||
| 404 | |||
| 405 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 406 | |||
| 407 | $this->assertTrue($attributes->nullable()); |
||
| 408 | $this->assertNull($attributes->default()); |
||
| 409 | |||
| 410 | |||
| 411 | $this->assertEquals($attributes->length(), 4294967295); |
||
| 412 | |||
| 413 | $this->assertNull($attributes->precision()); |
||
| 414 | $this->assertEquals($attributes->scale(), 0); |
||
| 415 | |||
| 416 | $this->assertIsArray($attributes->enums()); |
||
| 417 | $this->assertEmpty($attributes->enums()); |
||
| 418 | |||
| 419 | $this->assertEquals(SchemaAttributeInterface::TYPE_TEXT, $attributes->type()); |
||
| 420 | |||
| 421 | $this->assertFalse($attributes->isAuto()); |
||
| 422 | } |
||
| 423 | |||
| 424 | public function testAttributeForDataTypeTableDate() |
||
| 425 | { |
||
| 426 | $attributes = $this->schema->attributes('data_types_table', 'date'); |
||
| 427 | |||
| 428 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 429 | |||
| 430 | $this->assertTrue($attributes->nullable()); |
||
| 431 | $this->assertNull($attributes->default()); |
||
| 432 | |||
| 433 | $this->assertNull($attributes->length()); |
||
| 434 | |||
| 435 | $this->assertNull($attributes->precision()); |
||
| 436 | $this->assertEquals($attributes->scale(), 0); |
||
| 437 | |||
| 438 | $this->assertIsArray($attributes->enums()); |
||
| 439 | $this->assertEmpty($attributes->enums()); |
||
| 440 | |||
| 441 | $this->assertEquals(SchemaAttributeInterface::TYPE_DATE, $attributes->type()); |
||
| 442 | |||
| 443 | $this->assertFalse($attributes->isAuto()); |
||
| 444 | } |
||
| 445 | |||
| 446 | public function testAttributeForDataTypeTableDateTime() |
||
| 447 | { |
||
| 448 | $attributes = $this->schema->attributes('data_types_table', 'datetime'); |
||
| 449 | |||
| 450 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 451 | |||
| 452 | $this->assertTrue($attributes->nullable()); |
||
| 453 | $this->assertNull($attributes->default()); |
||
| 454 | |||
| 455 | $this->assertNull($attributes->length()); |
||
| 456 | |||
| 457 | $this->assertNull($attributes->precision()); |
||
| 458 | $this->assertEquals($attributes->scale(), 0); |
||
| 459 | |||
| 460 | $this->assertIsArray($attributes->enums()); |
||
| 461 | $this->assertEmpty($attributes->enums()); |
||
| 462 | |||
| 463 | $this->assertEquals(SchemaAttributeInterface::TYPE_DATETIME, $attributes->type()); |
||
| 464 | |||
| 465 | $this->assertFalse($attributes->isAuto()); |
||
| 466 | } |
||
| 467 | |||
| 468 | public function testAttributeForDataTypeTableTimestamp() |
||
| 469 | { |
||
| 470 | $attributes = $this->schema->attributes('data_types_table', 'timestamp'); |
||
| 471 | |||
| 472 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 473 | |||
| 474 | $this->assertTrue($attributes->nullable()); |
||
| 475 | $this->assertNull($attributes->default()); |
||
| 476 | |||
| 477 | $this->assertNull($attributes->length()); |
||
| 478 | |||
| 479 | $this->assertNull($attributes->precision()); |
||
| 480 | $this->assertEquals($attributes->scale(), 0); |
||
| 481 | |||
| 482 | $this->assertIsArray($attributes->enums()); |
||
| 483 | $this->assertEmpty($attributes->enums()); |
||
| 484 | |||
| 485 | $this->assertEquals(SchemaAttributeInterface::TYPE_TIMESTAMP, $attributes->type()); |
||
| 486 | |||
| 487 | $this->assertFalse($attributes->isAuto()); |
||
| 488 | } |
||
| 489 | |||
| 490 | public function testAttributeForDataTypeTableTime() |
||
| 491 | { |
||
| 492 | $attributes = $this->schema->attributes('data_types_table', 'time'); |
||
| 493 | |||
| 494 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 495 | |||
| 496 | $this->assertTrue($attributes->nullable()); |
||
| 497 | $this->assertNull($attributes->default()); |
||
| 498 | |||
| 499 | $this->assertNull($attributes->length()); |
||
| 500 | |||
| 501 | $this->assertNull($attributes->precision()); |
||
| 502 | $this->assertEquals($attributes->scale(), 0); |
||
| 503 | |||
| 504 | $this->assertIsArray($attributes->enums()); |
||
| 505 | $this->assertEmpty($attributes->enums()); |
||
| 506 | |||
| 507 | $this->assertEquals(SchemaAttributeInterface::TYPE_TIME, $attributes->type()); |
||
| 508 | |||
| 509 | $this->assertFalse($attributes->isAuto()); |
||
| 510 | } |
||
| 511 | |||
| 512 | public function testAttributeForDataTypeTableYear() |
||
| 513 | { |
||
| 514 | $attributes = $this->schema->attributes('data_types_table', 'year'); |
||
| 515 | |||
| 516 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 517 | |||
| 518 | $this->assertTrue($attributes->nullable()); |
||
| 519 | $this->assertNull($attributes->default()); |
||
| 520 | |||
| 521 | $this->assertNull($attributes->length()); |
||
| 522 | |||
| 523 | $this->assertNull($attributes->precision()); |
||
| 524 | $this->assertEquals($attributes->scale(), 0); |
||
| 525 | |||
| 526 | $this->assertIsArray($attributes->enums()); |
||
| 527 | $this->assertEmpty($attributes->enums()); |
||
| 528 | |||
| 529 | $this->assertEquals(SchemaAttributeInterface::TYPE_YEAR, $attributes->type()); |
||
| 530 | |||
| 531 | $this->assertFalse($attributes->isAuto()); |
||
| 532 | } |
||
| 533 | |||
| 534 | public function testAttributeForDataTypeTableEnum() |
||
| 535 | { |
||
| 536 | $attributes = $this->schema->attributes('data_types_table', 'enum_example'); |
||
| 537 | |||
| 538 | $this->assertInstanceOf(SchemaAttribute::class, $attributes); |
||
| 539 | |||
| 540 | $this->assertTrue($attributes->nullable()); |
||
| 541 | $this->assertNull($attributes->default()); |
||
| 542 | |||
| 543 | $this->assertEquals($attributes->length(), 6); |
||
| 544 | |||
| 545 | $this->assertNull($attributes->precision()); |
||
| 546 | $this->assertEquals($attributes->scale(), 0); |
||
| 547 | |||
| 548 | $this->assertIsArray($attributes->enums()); |
||
| 549 | $this->assertEquals($attributes->enums(), ['value1', 'value2', 'value3']); |
||
| 550 | |||
| 551 | $this->assertEquals(SchemaAttributeInterface::TYPE_ENUM, $attributes->type()); |
||
| 552 | |||
| 553 | $this->assertFalse($attributes->isAuto()); |
||
| 554 | } |
||
| 555 | |||
| 556 | } |
||
| 557 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths