- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
94 lines
3.4 KiB
PHP
94 lines
3.4 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Application\LiveComponents\CommentThreadComponent;
|
|
|
|
echo "Testing CommentThreadComponent Migration\n";
|
|
echo "=========================================\n\n";
|
|
|
|
try {
|
|
$component = new CommentThreadComponent(
|
|
id: 'comment-thread-test',
|
|
initialData: []
|
|
);
|
|
|
|
echo "✓ CommentThreadComponent created successfully\n";
|
|
echo " - ID: " . $component->getId() . "\n\n";
|
|
|
|
// Test addComment() method
|
|
echo "Testing addComment() method...\n";
|
|
$result = $component->addComment('Test comment', 'user1', 'John Doe');
|
|
echo " ✓ addComment() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Comments count: " . count($result['comments']) . "\n";
|
|
echo " - Keys: " . implode(', ', array_keys($result)) . "\n\n";
|
|
|
|
// Test editComment() method
|
|
$component2 = new CommentThreadComponent(
|
|
id: 'comment-thread-test-2',
|
|
initialData: ['comments' => [[
|
|
'id' => 'comment-1',
|
|
'content' => 'Original comment',
|
|
'author_id' => 'user1',
|
|
'author_name' => 'John Doe',
|
|
'parent_id' => null,
|
|
'created_at' => time(),
|
|
'updated_at' => null,
|
|
'reactions' => [],
|
|
'reply_count' => 0,
|
|
'is_edited' => false,
|
|
]]]
|
|
);
|
|
|
|
echo "Testing editComment() method...\n";
|
|
$result = $component2->editComment('comment-1', 'Edited comment');
|
|
echo " ✓ editComment() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Updated content: " . $result['comments'][0]['content'] . "\n";
|
|
echo " - Is edited: " . ($result['comments'][0]['is_edited'] ? 'true' : 'false') . "\n\n";
|
|
|
|
// Test deleteComment() method
|
|
echo "Testing deleteComment() method...\n";
|
|
$result = $component2->deleteComment('comment-1');
|
|
echo " ✓ deleteComment() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Comments count after delete: " . count($result['comments']) . "\n\n";
|
|
|
|
// Test addReaction() method
|
|
$component3 = new CommentThreadComponent(
|
|
id: 'comment-thread-test-3',
|
|
initialData: ['comments' => [[
|
|
'id' => 'comment-1',
|
|
'content' => 'Test comment',
|
|
'author_id' => 'user1',
|
|
'author_name' => 'John Doe',
|
|
'parent_id' => null,
|
|
'created_at' => time(),
|
|
'updated_at' => null,
|
|
'reactions' => [],
|
|
'reply_count' => 0,
|
|
'is_edited' => false,
|
|
]]]
|
|
);
|
|
|
|
echo "Testing addReaction() method...\n";
|
|
$result = $component3->addReaction('comment-1', 'like', 'user2');
|
|
echo " ✓ addReaction() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Reactions count: " . count($result['comments'][0]['reactions']) . "\n\n";
|
|
|
|
// Test changeSorting() method
|
|
echo "Testing changeSorting() method...\n";
|
|
$result = $component->changeSorting('oldest');
|
|
echo " ✓ changeSorting() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Sort by: " . $result['sort_by'] . "\n\n";
|
|
|
|
echo "=========================================\n";
|
|
echo "✅ All CommentThreadComponent tests passed!\n";
|
|
|
|
} catch (\Throwable $e) {
|
|
echo "❌ Error: " . $e->getMessage() . "\n";
|
|
echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
exit(1);
|
|
}
|