the middle of the idiots
This commit is contained in:
60
qwen/hack/tests/Models/JobTest.php
Normal file
60
qwen/hack/tests/Models/JobTest.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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(
|
||||
id: 1,
|
||||
title: 'Software Engineer',
|
||||
description: 'We are looking for a skilled software engineer...',
|
||||
location: 'New York, NY',
|
||||
employmentType: 'Full-time',
|
||||
tenantId: '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(
|
||||
id: 1,
|
||||
title: 'Software Engineer',
|
||||
description: 'We are looking for a skilled software engineer...',
|
||||
location: 'New York, NY',
|
||||
employmentType: 'Full-time',
|
||||
tenantId: '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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user