feat: add unit tests for User model name and email formatting
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m59s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Failing after 3m51s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 4m4s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 4m25s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 4m10s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Has been cancelled

This commit is contained in:
2025-11-30 19:39:49 -05:00
parent eaff49b6a4
commit 7792cac8b8

31
tests/Models/UserTest.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Models;
use Siteworxpro\App\Models\User;
use Siteworxpro\Tests\Unit;
class UserTest extends Unit
{
public function testFormatsName(): void
{
$user = new User();
$user->first_name = 'John';
$user->last_name = 'Doe';
$this->assertEquals('John Doe', $user->full_name);
}
public function testFormatsEmail(): void
{
$user = new User();
$user->first_name = 'Jane';
$user->last_name = 'Smith';
$user->email = 'jane.smith@email.com';
$this->assertEquals('Jane Smith <jane.smith@email.com>', $user->formatted_email);
}
}