Files
MOHPortalTest-AllAgents-All…/qwen/hack/tests/Models/JobTest.php
2025-10-24 17:06:14 -05:00

60 lines
2.0 KiB
PHP

<?hh // strict
namespace Tests\Models;
use App\Models\Job;
use DateTime;
use PHPUnit\Framework\TestCase;
class JobTest extends TestCase
{
public function testJobCreation(): void
{
$job = new Job(
1,
'Software Engineer',
'We are looking for a skilled software engineer...',
'New York, NY',
'Full-time',
'tenant-123'
);
$this->assertEquals(1, $job->getId());
$this->assertEquals('Software Engineer', $job->getTitle());
$this->assertEquals('We are looking for a skilled software engineer...', $job->getDescription());
$this->assertEquals('New York, NY', $job->getLocation());
$this->assertEquals('Full-time', $job->getEmploymentType());
$this->assertEquals('tenant-123', $job->getTenantId());
$this->assertInstanceOf(DateTime::class, $job->getCreatedAt());
$this->assertInstanceOf(DateTime::class, $job->getUpdatedAt());
}
public function testJobSetters(): void
{
$job = new Job(
1,
'Software Engineer',
'We are looking for a skilled software engineer...',
'New York, NY',
'Full-time',
'tenant-123'
);
$originalUpdatedAt = $job->getUpdatedAt();
// Update the job
$job->setTitle('Senior Software Engineer');
$job->setDescription('We are looking for a senior software engineer...');
$job->setLocation('Remote');
$job->setEmploymentType('Contract');
// Verify updates
$this->assertEquals('Senior Software Engineer', $job->getTitle());
$this->assertEquals('We are looking for a senior software engineer...', $job->getDescription());
$this->assertEquals('Remote', $job->getLocation());
$this->assertEquals('Contract', $job->getEmploymentType());
// Verify that updated_at was updated
$this->assertNotEquals($originalUpdatedAt, $job->getUpdatedAt());
}
}