Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPDATE] Better tests #52

Merged
merged 8 commits into from
May 31, 2024
Merged

[UPDATE] Better tests #52

merged 8 commits into from
May 31, 2024

Conversation

Neirda24
Copy link
Contributor

  • Fix risky tests
  • Add more tests
  • Fix issue with int / float parsing with Units

@@ -535,8 +535,8 @@ private function addConfiguration(string $configurationName, mixed $value): void
'single_page' => $this->singlePage($value),
'pdf_format' => $this->pdfFormat(PdfFormat::from($value)),
'pdf_universal_access' => $this->pdfUniversalAccess($value),
'paper_width' => $this->paperWidth($value),
'paper_height' => $this->paperHeight($value),
'paper_width' => $splitAndParseStringWithUnit($value, $this->paperWidth(...)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a Util/UnitParser with static methods. We could also test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems a bit much for just one usecase ? It is indirectly tested already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are units used in with LibreOffice? If so, this util could be useful.

If not, let's keep it that way!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with tests

src/Builder/Pdf/AbstractPdfBuilder.php Outdated Show resolved Hide resolved

protected function setUp(): void
{
self::$gotenbergClient = $this->createMock(GotenbergClientInterface::class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this variable static ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reasons... habits I guess. Will change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

tests/Builder/AbstractBuilderTestCase.php Show resolved Hide resolved
$builder->header('templates/invalid.html.twig');
}

private function getChromiumPdfBuilder(false|null $twig = null): AbstractChromiumPdfBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false|null $twig = null => bool $injectTwig = true ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. Don't know why I didn't went that way...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Neirda24 Neirda24 requested a review from Jean-Beru May 30, 2024 16:13
@Neirda24 Neirda24 changed the title [WIP] [UPDATE] Better tests [UPDATE] Better tests May 31, 2024
@Neirda24 Neirda24 merged commit 1e4348d into main May 31, 2024
@Neirda24 Neirda24 deleted the feature/tests branch May 31, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants