Skip to content

Commit

Permalink
Merge pull request #173 from CPS-IT/task/phpstan-tests
Browse files Browse the repository at this point in the history
[TASK] Enable PHPStan for tests
  • Loading branch information
eliashaeussler authored Jun 17, 2024
2 parents 2e2af07 + 7166ddc commit e176f9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Tests/Unit/Service/PersonioApiServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ private static function assertJobEqualsJob(Job $expected, Job $actual): void
// Fetch actual job descriptions to compare them separately
$actualJobDescriptions = $actual->getJobDescriptions()->toArray();

/** @var ObjectStorage<JobDescription> $jobDescriptions */
$jobDescriptions = new ObjectStorage();

// Reset job descriptions (we compare them separately)
$actual->setJobDescriptions(new ObjectStorage());
$actual->setJobDescriptions($jobDescriptions);
$actual->recalculateContentHash();

// Compare job
Expand All @@ -177,6 +180,10 @@ private static function assertJobEqualsJob(Job $expected, Job $actual): void

private function createJob(int $id, ?YearsOfExperience $yearsOfExperience = YearsOfExperience::TwoFiveYears): Job
{
$createDate = \DateTime::createFromFormat(\DateTimeInterface::ATOM, '2023-08-11T14:15:17+00:00');

self::assertNotFalse($createDate);

$job = (new Job())
->setPersonioId($id)
->setSubcompany('Test company')
Expand All @@ -191,7 +198,7 @@ private function createJob(int $id, ?YearsOfExperience $yearsOfExperience = Year
->setKeywords('Testing,QA,Fun')
->setOccupation('software_and_web_development')
->setOccupationCategory('it_software')
->setCreateDate(\DateTime::createFromFormat(\DateTimeInterface::ATOM, '2023-08-11T14:15:17+00:00'));
->setCreateDate($createDate);
$job->recalculateContentHash();

return $job;
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ parameters:
paths:
- Classes
- Configuration
- Tests

0 comments on commit e176f9c

Please sign in to comment.