Skip to content

Commit

Permalink
Updates version constraints and fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maechler committed Oct 31, 2021
1 parent 20d16cb commit c137e7b
Show file tree
Hide file tree
Showing 17 changed files with 147 additions and 151 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ language: php
matrix:
fast_finish: true
include:
- php: 7.0
env: TYPO3_VERSION=^8
- php: 7.1
env: TYPO3_VERSION=^8
- php: 7.2
env: TYPO3_VERSION=^9
- php: 7.3
env: TYPO3_VERSION=^9 COVERAGE="YES"
- php: 7.4
env: TYPO3_VERSION=^10
- php: 8.0
env: TYPO3_VERSION=^11

services:
- mysql
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/AbstractFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ abstract class AbstractFunctionalTest extends FunctionalTestCase
*
* @return void
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
111 changes: 55 additions & 56 deletions Tests/Functional/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ public function testFullFeatureShowCase()

$this->assertEquals(5, count($pages));

$this->assertContains('hallo@bithost.ch - www.bithost.ch', $pages[0]->getText());
$this->assertContains('Full Feature Show Case', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('hallo@bithost.ch - www.bithost.ch', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Full Feature Show Case', $pages[0]->getText());

$this->assertContains('hallo@bithost.ch - www.bithost.ch', $pages[1]->getText());
$this->assertContains('Application Development', $pages[1]->getText());
$this->assertContains('This is a h1 headline', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('hallo@bithost.ch - www.bithost.ch', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Application Development', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('This is a h1 headline', $pages[1]->getText());

$this->assertContains('Only this page will have a different header', $pages[2]->getText());
$this->assertStringContainsStringIgnoringCase('Only this page will have a different header', $pages[2]->getText());

$this->assertContains('hallo@bithost.ch - www.bithost.ch', $pages[3]->getText());
$this->assertContains('HTML content being styled externally', $pages[3]->getText());
$this->assertContains('A Link to click', $pages[3]->getText());
$this->assertContains('We are on page 4 of 5 pages.', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('hallo@bithost.ch - www.bithost.ch', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('HTML content being styled externally', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('A Link to click', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('We are on page 4 of 5 pages.', $pages[3]->getText());

$this->assertContains('Avoid page break inside', $pages[4]->getText());
$this->assertStringContainsStringIgnoringCase('Avoid page break inside', $pages[4]->getText());

$this->validatePDF($output);

Expand All @@ -87,12 +87,12 @@ public function testBasicUsage()
$text = $pdf->getText();

$this->assertEquals(1, count($pdf->getPages()));
$this->assertContains('28.03.2013', $text);
$this->assertContains('Welcome to the extension pdfviewhelpers', $text);
$this->assertContains('Some more information', $text);
$this->assertContains('Lorem ipsum', $text);
$this->assertContains('Esteban Gehring, Markus Mächler', $text);
$this->assertContains('Bithost GmbH', $text);
$this->assertStringContainsStringIgnoringCase('28.03.2013', $text);
$this->assertStringContainsStringIgnoringCase('Welcome to the extension pdfviewhelpers', $text);
$this->assertStringContainsStringIgnoringCase('Some more information', $text);
$this->assertStringContainsStringIgnoringCase('Lorem ipsum', $text);
$this->assertStringContainsStringIgnoringCase('Esteban Gehring, Markus Mächler', $text);
$this->assertStringContainsStringIgnoringCase('Bithost GmbH', $text);

$this->validatePDF($output);

Expand All @@ -113,12 +113,12 @@ public function testExtendExistingPDFs()
$text = $pdf->getText();

$this->assertEquals(1, count($pdf->getPages()));
$this->assertContains('Mega GmbH', $text);
$this->assertContains('Ansprechpartner', $text);
$this->assertContains('www.bithost.ch', $text);
$this->assertContains('Here is your header', $text);
$this->assertContains('Here is the HTML header', $text);
$this->assertContains('Lorem ipsum dolor sit amet', $text);
$this->assertStringContainsStringIgnoringCase('Mega GmbH', $text);
$this->assertStringContainsStringIgnoringCase('Ansprechpartner', $text);
$this->assertStringContainsStringIgnoringCase('www.bithost.ch', $text);
$this->assertStringContainsStringIgnoringCase('Here is your header', $text);
$this->assertStringContainsStringIgnoringCase('Here is the HTML header', $text);
$this->assertStringContainsStringIgnoringCase('Lorem ipsum dolor sit amet', $text);

$this->validatePDF($output);

Expand All @@ -140,39 +140,38 @@ public function testTableOfContent()

$this->assertCount(5, $pages);

$this->assertContains('HTML Table of content', $pages[0]->getText());
$this->assertContains('html-table-of-content-header', $pages[0]->getText());
$this->assertContains('html-table-of-content-footer', $pages[0]->getText());
$this->assertContains('LEVEL 0: Headline page 1', $pages[0]->getText());
$this->assertContains('LEVEL 0: Headline page 2', $pages[0]->getText());
$this->assertContains('LEVEL 1: Headline page 2, level 1', $pages[0]->getText());
$this->assertContains('LEVEL 0: Adding custom styled bookmark for a text', $pages[0]->getText());
$this->assertContains('LEVEL 0: Adding custom styled ADVANCED bookmark for a text', $pages[0]->getText());
$this->assertNotContains('Headline not in table of content', $pages[0]->getText());

$this->assertContains('Regular table of content', $pages[1]->getText());
$this->assertContains('regular-table-of-content-header', $pages[1]->getText());
$this->assertContains('regular-table-of-content-footer', $pages[1]->getText());
$this->assertContains('Headline page 1', $pages[1]->getText());
$this->assertContains('Headline page 2', $pages[1]->getText());
$this->assertContains('Headline page 2, level 1', $pages[1]->getText());
$this->assertContains('Adding custom styled bookmark for a text', $pages[1]->getText());
$this->assertContains('Adding custom styled ADVANCED bookmark for a text', $pages[1]->getText());
$this->assertNotContains('LEVEL 0', $pages[1]->getText());
$this->assertNotContains('LEVEL 1', $pages[1]->getText());
$this->assertNotContains('Headline not in table of content', $pages[1]->getText());

$this->assertContains('Headline page 1', $pages[2]->getText());
$this->assertContains('General Header', $pages[2]->getText());
$this->assertContains('General Footer', $pages[2]->getText());

$this->assertContains('Headline page 2', $pages[3]->getText());
$this->assertContains('Headline page 2, level 1', $pages[3]->getText());
$this->assertContains('Headline page 2, level 2', $pages[3]->getText());

$this->assertContains('Headline not in table of content', $pages[4]->getText());
$this->assertContains('Here is some text', $pages[4]->getText());
$this->assertContains('Headline not in table of content', $pages[4]->getText());
$this->assertStringContainsStringIgnoringCase('HTML Table of content', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('html-table-of-content-header', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('html-table-of-content-footer', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('LEVEL 0: Headline page 1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('LEVEL 0: Headline page 2', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('LEVEL 1: Headline page 2, level 1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('LEVEL 0: Adding custom styled bookmark for a text', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('LEVEL 0: Adding custom styled ADVANCED bookmark for a text', $pages[0]->getText());
$this->assertStringNotContainsStringIgnoringCase('Headline not in table of content', $pages[0]->getText());

$this->assertStringContainsStringIgnoringCase('Regular table of content', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('regular-table-of-content-header', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('regular-table-of-content-footer', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Headline page 1', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Headline page 2', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Headline page 2, level 1', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Adding custom styled bookmark for a text', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Adding custom styled ADVANCED bookmark for a text', $pages[1]->getText());
$this->assertStringNotContainsStringIgnoringCase('LEVEL 0', $pages[1]->getText());
$this->assertStringNotContainsStringIgnoringCase('Headline not in table of content', $pages[1]->getText());

$this->assertStringContainsStringIgnoringCase('Headline page 1', $pages[2]->getText());
$this->assertStringContainsStringIgnoringCase('General Header', $pages[2]->getText());
$this->assertStringContainsStringIgnoringCase('General Footer', $pages[2]->getText());

$this->assertStringContainsStringIgnoringCase('Headline page 2', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('Headline page 2, level 1', $pages[3]->getText());
$this->assertStringContainsStringIgnoringCase('Headline page 2, level 2', $pages[3]->getText());

$this->assertStringContainsStringIgnoringCase('Headline not in table of content', $pages[4]->getText());
$this->assertStringContainsStringIgnoringCase('Here is some text', $pages[4]->getText());
$this->assertStringContainsStringIgnoringCase('Headline not in table of content', $pages[4]->getText());

//Do not validate as TCPDF does not produce valid documents having bookmarks
//$this->validatePDF($output);
Expand Down
36 changes: 18 additions & 18 deletions Tests/Functional/ExtendExistingPDFsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public function testDoImportOnAutomaticPageBreak()

$this->assertCount(2, $pages);

$this->assertContains('Mega GmbH', $pages[0]->getText());
$this->assertContains('Ansprechpartner', $pages[0]->getText());
$this->assertContains('www.bithost.ch', $pages[0]->getText());
$this->assertContains('Lorem ipsum dolor sit amet', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Mega GmbH', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Ansprechpartner', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('www.bithost.ch', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Lorem ipsum dolor sit amet', $pages[0]->getText());

$this->assertContains('Mega GmbH', $pages[1]->getText());
$this->assertContains('Ansprechpartner', $pages[1]->getText());
$this->assertContains('www.bithost.ch', $pages[1]->getText());
$this->assertContains('Lorem ipsum dolor sit amet', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Mega GmbH', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Ansprechpartner', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('www.bithost.ch', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Lorem ipsum dolor sit amet', $pages[1]->getText());
}

/**
Expand All @@ -82,24 +82,24 @@ public function testDoNotImportOnAutomaticPageBreak()

$this->assertCount(2, $pages);

$this->assertContains('Mega GmbH', $pages[0]->getText());
$this->assertContains('Ansprechpartner', $pages[0]->getText());
$this->assertContains('www.bithost.ch', $pages[0]->getText());
$this->assertContains('Lorem ipsum dolor sit amet', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Mega GmbH', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Ansprechpartner', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('www.bithost.ch', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('Lorem ipsum dolor sit amet', $pages[0]->getText());

$this->assertNotContains('Mega GmbH', $pages[1]->getText());
$this->assertNotContains('Ansprechpartner', $pages[1]->getText());
$this->assertNotContains('www.bithost.ch', $pages[1]->getText());
$this->assertContains('Lorem ipsum dolor sit amet', $pages[1]->getText());
$this->assertStringNotContainsStringIgnoringCase('Mega GmbH', $pages[1]->getText());
$this->assertStringNotContainsStringIgnoringCase('Ansprechpartner', $pages[1]->getText());
$this->assertStringNotContainsStringIgnoringCase('www.bithost.ch', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('Lorem ipsum dolor sit amet', $pages[1]->getText());
}

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\Exception
*/
public function testImportWrongPage()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\Exception::class);

$this->renderFluidTemplate(
$this->getFixturePath('ExtendExistingPDFs/Template.html'),
[
Expand Down
22 changes: 11 additions & 11 deletions Tests/Functional/SpeakingSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testSetupSettings()
$pdf = $this->parseContent($output);
$text = $pdf->getText();

$this->assertContains('Test', $text);
$this->assertStringContainsStringIgnoringCase('Test', $text);
}

/**
Expand All @@ -60,7 +60,7 @@ public function testSpeakingSetupSettings()
$pdf = $this->parseContent($output);
$text = $pdf->getText();

$this->assertContains('Test', $text);
$this->assertStringContainsStringIgnoringCase('Test', $text);
}

/**
Expand Down Expand Up @@ -93,17 +93,17 @@ public function testFluid()
$pdf = $this->parseContent($output);
$text = $pdf->getText();

$this->assertContains('Test', $text);
$this->assertStringContainsStringIgnoringCase('Test', $text);
}
}

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\ValidationException
*/
public function testInvalidOutputDestination()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\ValidationException::class);

$this->renderFluidTemplate(
$this->getFixturePath('SpeakingSettings/FluidAttributes.html'),
[
Expand All @@ -117,11 +117,11 @@ public function testInvalidOutputDestination()

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\ValidationException
*/
public function testInvalidOrientation()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\ValidationException::class);

$this->renderFluidTemplate(
$this->getFixturePath('SpeakingSettings/FluidAttributes.html'),
[
Expand All @@ -135,11 +135,11 @@ public function testInvalidOrientation()

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\ValidationException
*/
public function testInvalidFontStyle()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\ValidationException::class);

$this->renderFluidTemplate(
$this->getFixturePath('SpeakingSettings/FluidAttributes.html'),
[
Expand All @@ -153,11 +153,11 @@ public function testInvalidFontStyle()

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\ValidationException
*/
public function testInvalidAlignment()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\ValidationException::class);

$this->renderFluidTemplate(
$this->getFixturePath('SpeakingSettings/FluidAttributes.html'),
[
Expand Down
20 changes: 10 additions & 10 deletions Tests/Functional/ViewHelpers/AvoidPageBreakInsideViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function testPageBreakPossible1()
$pages = $pdf->getPages();

$this->assertCount(2, $pages);
$this->assertContains('text1', $pages[0]->getText());
$this->assertContains('text2', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('text1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text2', $pages[1]->getText());
}

/**
Expand All @@ -78,8 +78,8 @@ public function testPageBreakPossible2()
$pages = $pdf->getPages();

$this->assertCount(2, $pages);
$this->assertContains('text1', $pages[0]->getText());
$this->assertContains('text2', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('text1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text2', $pages[1]->getText());
}

/**
Expand All @@ -100,8 +100,8 @@ public function testImpossibleToAvoid1()
$pages = $pdf->getPages();

$this->assertCount(2, $pages);
$this->assertContains('text1', $pages[0]->getText());
$this->assertContains('text2', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text2', $pages[0]->getText());
}

/**
Expand All @@ -122,8 +122,8 @@ public function testImpossibleToAvoid2()
$pages = $pdf->getPages();

$this->assertCount(3, $pages);
$this->assertContains('text1', $pages[0]->getText());
$this->assertContains('text2', $pages[1]->getText());
$this->assertStringContainsStringIgnoringCase('text1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text2', $pages[1]->getText());
}

/**
Expand All @@ -145,7 +145,7 @@ public function testCustomFont()
$pages = $pdf->getPages();

$this->assertCount(1, $pages);
$this->assertContains('text1', $pages[0]->getText());
$this->assertContains('text2', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text1', $pages[0]->getText());
$this->assertStringContainsStringIgnoringCase('text2', $pages[0]->getText());
}
}
12 changes: 6 additions & 6 deletions Tests/Functional/ViewHelpers/HtmlViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ public function testRenderRichText()
);
$pdf = $this->parseContent($output);

$this->assertContains('Headline', $pdf->getText());
$this->assertContains('Text', $pdf->getText());
$this->assertNotContains('<h1>', $pdf->getText());
$this->assertNotContains('<p>', $pdf->getText());
$this->assertStringContainsStringIgnoringCase('Headline', $pdf->getText());
$this->assertStringContainsStringIgnoringCase('Text', $pdf->getText());
$this->assertStringNotContainsStringIgnoringCase('<h1>', $pdf->getText());
$this->assertStringNotContainsStringIgnoringCase('<p>', $pdf->getText());
}

/**
* @test
*
* @expectedException \Bithost\Pdfviewhelpers\Exception\ValidationException
*/
public function testInvalidStylesheet()
{
$this->expectException(\Bithost\Pdfviewhelpers\Exception\ValidationException::class);

$this->renderFluidTemplate(
$this->getFixturePath('HtmlViewHelper/Html.html'),
['html' => '', 'styleSheet' => 'EXT:pdfviewhelpers/Tests/Functional/Fixtures/HtmlViewHelper/NonExistingPath.css']
Expand Down
Loading

0 comments on commit c137e7b

Please sign in to comment.