- 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.
81 lines
3.0 KiB
PHP
Executable File
81 lines
3.0 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Application\LiveComponents\ShoppingCartComponent;
|
|
|
|
echo "Testing ShoppingCartComponent Migration\n";
|
|
echo "========================================\n\n";
|
|
|
|
try {
|
|
$cart = new ShoppingCartComponent(
|
|
id: 'cart-test',
|
|
initialData: []
|
|
);
|
|
|
|
echo "✓ ShoppingCartComponent created successfully\n";
|
|
echo " - ID: " . $cart->getId() . "\n\n";
|
|
|
|
// Test addItem() method
|
|
echo "Testing addItem() method...\n";
|
|
$result = $cart->addItem('product-1', 'Test Product', 29.99, 2);
|
|
echo " ✓ addItem() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Items count: " . count($result['items']) . "\n\n";
|
|
|
|
// Test updateQuantity() method
|
|
$cart2 = new ShoppingCartComponent(
|
|
id: 'cart-test-2',
|
|
initialData: ['items' => [[
|
|
'id' => 'item-1',
|
|
'product_id' => 'product-1',
|
|
'product_name' => 'Test Product',
|
|
'price' => 29.99,
|
|
'quantity' => 2,
|
|
'attributes' => [],
|
|
'added_at' => time(),
|
|
'updated_at' => time(),
|
|
]]]
|
|
);
|
|
|
|
echo "Testing updateQuantity() method...\n";
|
|
$result = $cart2->updateQuantity('item-1', 5);
|
|
echo " ✓ updateQuantity() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - New quantity: " . $result['items'][0]['quantity'] . "\n\n";
|
|
|
|
// Test applyDiscountCode() method
|
|
echo "Testing applyDiscountCode() method...\n";
|
|
$result = $cart->applyDiscountCode('WELCOME10');
|
|
echo " ✓ applyDiscountCode() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Discount code: " . ($result['discount_code'] ?? 'none') . "\n";
|
|
echo " - Discount percentage: " . $result['discount_percentage'] . "\n\n";
|
|
|
|
// Test removeDiscountCode() method
|
|
echo "Testing removeDiscountCode() method...\n";
|
|
$result = $cart->removeDiscountCode();
|
|
echo " ✓ removeDiscountCode() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Discount code: " . ($result['discount_code'] ?? 'null') . "\n\n";
|
|
|
|
// Test changeShippingMethod() method
|
|
echo "Testing changeShippingMethod() method...\n";
|
|
$result = $cart->changeShippingMethod('express');
|
|
echo " ✓ changeShippingMethod() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Shipping method: " . $result['shipping_method'] . "\n\n";
|
|
|
|
// Test clearCart() method
|
|
echo "Testing clearCart() method...\n";
|
|
$result = $cart->clearCart();
|
|
echo " ✓ clearCart() returns array: " . (is_array($result) ? 'YES' : 'NO') . "\n";
|
|
echo " - Items count: " . count($result['items']) . "\n\n";
|
|
|
|
echo "========================================\n";
|
|
echo "✅ All ShoppingCartComponent tests passed!\n";
|
|
|
|
} catch (\Throwable $e) {
|
|
echo "❌ Error: " . $e->getMessage() . "\n";
|
|
echo " File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
exit(1);
|
|
}
|