feat(shared) : add column comments catalog helper for migrations
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Unit\Shared\Database;
|
||||
|
||||
use App\Shared\Infrastructure\Database\ColumnCommentsCatalog;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class ColumnCommentsCatalogTest extends TestCase
|
||||
{
|
||||
public function testTimestampableBlamableCommentsCoverFourColumns(): void
|
||||
{
|
||||
$sql = ColumnCommentsCatalog::timestampableBlamableComments('task');
|
||||
|
||||
self::assertCount(4, $sql);
|
||||
self::assertSame(
|
||||
"COMMENT ON COLUMN task.created_at IS 'Date de creation (UTC). Rempli automatiquement (Timestampable).'",
|
||||
$sql[0],
|
||||
);
|
||||
self::assertStringContainsString('COMMENT ON COLUMN task.created_by IS', $sql[2]);
|
||||
}
|
||||
|
||||
public function testTableNameIsInterpolatedForEveryColumn(): void
|
||||
{
|
||||
foreach (ColumnCommentsCatalog::timestampableBlamableComments('time_entry') as $statement) {
|
||||
self::assertStringContainsString('COMMENT ON COLUMN time_entry.', $statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user