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

Add more tests #55

Merged
merged 3 commits into from
Jun 3, 2024
Merged

Add more tests #55

merged 3 commits into from
Jun 3, 2024

Conversation

Neirda24
Copy link
Contributor

@Neirda24 Neirda24 commented Jun 1, 2024

$ ./vendor/bin/phpunit --coverage-html ./coverage-html --testdox
PHPUnit 10.5.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.7 with PCOV 1.0.11
Configuration: /Users/neirda/Projects/Sensiolabs/OpenSource/Gotenberg/GotenbergBundle/phpunit.xml

...............................................................  63 / 154 ( 40%)
............................................................... 126 / 154 ( 81%)
............................                                    154 / 154 (100%)

Time: 00:00.121, Memory: 26.00 MB

Abstract Chromium Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\AbstractChromiumPdfBuilder)
 ✔ Configuration "single_page" is correctly set
 ✔ Configuration "pdf_format - A-1b" is correctly set
 ✔ Configuration "pdf_universal_access" is correctly set
 ✔ Configuration "paper_width" is correctly set
 ✔ Configuration "paper_height" is correctly set
 ✔ Configuration "margin_top" is correctly set
 ✔ Configuration "margin_bottom" is correctly set
 ✔ Configuration "margin_left" is correctly set
 ✔ Configuration "margin_right" is correctly set
 ✔ Configuration "prefer_css_page_size" is correctly set
 ✔ Configuration "print_background" is correctly set
 ✔ Configuration "omit_background" is correctly set
 ✔ Configuration "landscape" is correctly set
 ✔ Configuration "scale" is correctly set
 ✔ Configuration "native_page_ranges" is correctly set
 ✔ Configuration "wait_delay" is correctly set
 ✔ Configuration "wait_for_expression" is correctly set
 ✔ Configuration "emulated_media_type" is correctly set
 ✔ Configuration "cookies" is correctly set
 ✔ Configuration "extra_http_headers" is correctly set
 ✔ Configuration "fail_on_http_status_codes" is correctly set
 ✔ Configuration "fail_on_console_exceptions" is correctly set
 ✔ Configuration "skip_network_idle_event" is correctly set
 ✔ Configuration "metadata" is correctly set
 ✔ Paper size applies width and height
 ✔ Paper standard size applies correctly
 ✔ Margins applies correctly
 ✔ Pdf format can be reset
 ✔ Twig header is correctly rendered
 ✔ Twig footer is correctly rendered
 ✔ Plain file header is correctly rendered
 ✔ Plain file footer is correctly rendered
 ✔ Assets can be added using php
 ✔ Assets can be added using twig
 ✔ Can add cookies
 ✔ Can add extra http headers
 ✔ Can add metadata
 ✔ Throw if twig not available
 ✔ Throw if twig template is invalid

Abstract Chromium Screenshot Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Screenshot\AbstractChromiumScreenshotBuilder)
 ✔ Configuration "width" is correctly set
 ✔ Configuration "height" is correctly set
 ✔ Configuration "clip" is correctly set
 ✔ Configuration "format" is correctly set
 ✔ Configuration "quality" is correctly set
 ✔ Configuration "omit_background" is correctly set
 ✔ Configuration "optimize_for_speed" is correctly set
 ✔ Configuration "wait_delay" is correctly set
 ✔ Configuration "wait_for_expression" is correctly set
 ✔ Configuration "emulated_media_type" is correctly set
 ✔ Configuration "cookies" is correctly set
 ✔ Configuration "extra_http_headers" is correctly set
 ✔ Configuration "fail_on_http_status_codes" is correctly set
 ✔ Configuration "fail_on_console_exceptions" is correctly set
 ✔ Configuration "skip_network_idle_event" is correctly set

Abstract Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\AbstractPdfBuilder)
 ✔ Filename is correctly set on response
 ✔ Form field "extraHttpHeaders" is correctly normalized
 ✔ Form field "assets" is correctly normalized
 ✔ Form field "header.html" is correctly normalized
 ✔ Form field "index.html" is correctly normalized
 ✔ Form field "footer.html" is correctly normalized
 ✔ Form field "failOnHttpStatusCodes" is correctly normalized
 ✔ Form field "cookies" is correctly normalized
 ✔ Form field "metadata" is correctly normalized
 ✔ Native "boolean (true)" is correctly normalized
 ✔ Native "boolean (false)" is correctly normalized
 ✔ Native "int" is correctly normalized
 ✔ Native "float (.0)" is correctly normalized
 ✔ Native "float (.5)" is correctly normalized

Abstract Screenshot Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Screenshot\AbstractScreenshotBuilder)
 ✔ Filename is correctly set on response
 ✔ Form field "extraHttpHeaders" is correctly normalized
 ✔ Form field "assets" is correctly normalized
 ✔ Form field "header.html" is correctly normalized
 ✔ Form field "index.html" is correctly normalized
 ✔ Form field "footer.html" is correctly normalized
 ✔ Form field "failOnHttpStatusCodes" is correctly normalized
 ✔ Form field "cookies" is correctly normalized
 ✔ Native "boolean (true)" is correctly normalized
 ✔ Native "boolean (false)" is correctly normalized
 ✔ Native "int" is correctly normalized
 ✔ Native "float (.0)" is correctly normalized
 ✔ Native "float (.5)" is correctly normalized

Asset Base Dir Formatter (Formatter\AssetBaseDirFormatter)
 ✔ Resolve path when "absolute path and absolute base dir"
 ✔ Resolve path when "absolute path and relative base dir"
 ✔ Resolve path when "relative path and relative base dir"
 ✔ Resolve path when "relative path and relative base dir with end slash"
 ✔ Resolve path when "relative path and absolute base dir"

Configuration (Sensiolabs\GotenbergBundle\Tests\DependencyInjection\Configuration)
 ✔ Default config is correct
 ✔ Invalid native page range with data set "as string"
 ✔ Invalid native page range with data set "as integer"
 ✔ Invalid native page range with data set "as boolean"
 ✔ With extra headers configuration

Gotenberg Client (Sensiolabs\GotenbergBundle\Tests\Client\GotenbergClient)
 ✔ Call is correctly formatted

Gotenberg Pass (Sensiolabs\GotenbergBundle\Tests\DependencyInjection\CompilerPass\GotenbergPass)
 ✔ It does nothing if data collector not registered
 ✔ It decorates pdf builders with traceable when data collector is present

Gotenberg Pdf (Sensiolabs\GotenbergBundle\Tests\GotenbergPdf)
 ✔ Url builder factory
 ✔ Html builder factory
 ✔ Markdown builder factory
 ✔ Office builder factory

Gotenberg Screenshot (Sensiolabs\GotenbergBundle\Tests\GotenbergScreenshot)
 ✔ Url builder factory
 ✔ Html builder factory
 ✔ Markdown builder factory

Html Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\HtmlPdfBuilder)
 ✔ Endpoint is correct
 ✔ With plain content file with data set "with twig"
 ✔ With plain content file with data set "without twig"
 ✔ With twig content file
 ✔ Required form data

Html Screenshot Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Screenshot\HtmlScreenshotBuilder)
 ✔ Endpoint is correct
 ✔ With plain content file with data set "with twig"
 ✔ With plain content file with data set "without twig"
 ✔ With twig content file
 ✔ Required form data

Libre Office Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\LibreOfficePdfBuilder)
 ✔ Endpoint is correct
 ✔ Configuration is correctly set with data set "pdf_format"
 ✔ Configuration is correctly set with data set "pdf_universal_access"
 ✔ Configuration is correctly set with data set "landscape"
 ✔ Configuration is correctly set with data set "native_page_ranges"
 ✔ Configuration is correctly set with data set "merge"
 ✔ Configuration is correctly set with data set "metadata"
 ✔ Office files with data set "odt"
 ✔ Office files with data set "docx"
 ✔ Office files with data set "html"
 ✔ Office files with data set "xslx"
 ✔ Office files with data set "pptx"
 ✔ Required form data

Markdown Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\MarkdownPdfBuilder)
 ✔ Endpoint is correct
 ✔ Required wrapper template
 ✔ Required markdown file

Markdown Screenshot Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Screenshot\MarkdownScreenshotBuilder)
 ✔ Endpoint is correct
 ✔ Markdown file
 ✔ Required wrapper template
 ✔ Required markdown file

Paper Size (Sensiolabs\GotenbergBundle\Tests\Enum\PaperSize)
 ✔ Unit is always inches
 ✔ Width
 ✔ Height

Sensiolabs Gotenberg Bundle (Sensiolabs\GotenbergBundle\Tests\SensiolabsGotenbergBundle)
 ✔ Can be auto discovered
 ✔ Compiler passes are all set

Sensiolabs Gotenberg Extension (Sensiolabs\GotenbergBundle\Tests\DependencyInjection\SensiolabsGotenbergExtension)
 ✔ Gotenberg configured with valid config
 ✔ Gotenberg client configured with default config
 ✔ Gotenberg client configured with valid config
 ✔ Data collector is not enabled when kernel debug is false
 ✔ Data collector is enabled when kernel debug is true
 ✔ Data collector is properly configured if enabled

Unit (Enum\Unit)
 ✔ It can be parsed correctly with data set "(int) 12"
 ✔ It can be parsed correctly with data set "(string) 12"
 ✔ It can be parsed correctly with data set "12.0"
 ✔ It can be parsed correctly with data set "12.1"
 ✔ It can be parsed correctly with data set "12.1in"
 ✔ It can be parsed correctly with data set "12.1pc"

Url Pdf Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Pdf\UrlPdfBuilder)
 ✔ Endpoint is correct
 ✔ Url
 ✔ Required form data

Url Screenshot Builder (Sensiolabs\GotenbergBundle\Tests\Builder\Screenshot\UrlScreenshotBuilder)
 ✔ Endpoint is correct
 ✔ Url
 ✔ Required form data

OK (154 tests, 374 assertions)

Generating code coverage report in HTML format ... done [00:00.057]

@Neirda24 Neirda24 changed the title WIP : [UPDATE] More tests [UPDATE] More tests Jun 1, 2024
@Neirda24 Neirda24 changed the title [UPDATE] More tests Add more tests Jun 1, 2024
tests/Client/GotenbergClientTest.php Outdated Show resolved Hide resolved
tests/Client/GotenbergClientTest.php Outdated Show resolved Hide resolved
tests/SensiolabsGotenbergBundleTest.php Show resolved Hide resolved
@Neirda24 Neirda24 merged commit 813b612 into main Jun 3, 2024
@Neirda24 Neirda24 deleted the feature/tests branch June 3, 2024 17:05
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.

2 participants