Skip to content

Commit

Permalink
Merge pull request #2494 from PHPOffice/dependabot/composer/phpstan/p…
Browse files Browse the repository at this point in the history
…hpstan-phpunit-1.3.15

Bump phpstan/phpstan-phpunit from 1.3.14 to 1.3.15
  • Loading branch information
Progi1984 committed Nov 2, 2023
2 parents b85f32c + 3bf29c7 commit d5ca5b4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
26 changes: 12 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/changes/1.x/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
- Bump mpdf/mpdf from 8.1.6 to 8.2.0 by [@dependabot](https://github.com/dependabot) in [#2480](https://github.com/PHPOffice/PHPWord/pull/2480)
- Bump phpunit/phpunit from 9.6.11 to 9.6.13 by [@dependabot](https://github.com/dependabot) in [#2481](https://github.com/PHPOffice/PHPWord/pull/2481)
- Bump tecnickcom/tcpdf from 6.6.2 to 6.6.5 by [@dependabot](https://github.com/dependabot) in [#2482](https://github.com/PHPOffice/PHPWord/pull/2482)
- Bump phpmd/phpmd from 2.13.0 to 2.14.1 by [@dependabot](https://github.com/dependabot) in [#2483](https://github.com/PHPOffice/PHPWord/pull/2483)
- Bump phpmd/phpmd from 2.13.0 to 2.14.1 by [@dependabot](https://github.com/dependabot) in [#2483](https://github.com/PHPOffice/PHPWord/pull/2483)
- Bump phpstan/phpstan-phpunit from 1.3.14 to 1.3.15 by [@dependabot](https://github.com/dependabot) in [#2494](https://github.com/PHPOffice/PHPWord/pull/2494)
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1690,11 +1690,6 @@ parameters:
count: 1
path: tests/PhpWordTests/PhpWordTest.php

-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:getElements\\(\\)\\.$#"
count: 1
path: tests/PhpWordTests/Reader/Word2007/ElementTest.php

-
message: "#^Call to an undefined method PhpOffice\\\\PhpWord\\\\Element\\\\AbstractElement\\:\\:getRows\\(\\)\\.$#"
count: 1
Expand Down
33 changes: 22 additions & 11 deletions tests/PhpWordTests/Reader/Word2007/ElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

namespace PhpOffice\PhpWordTests\Reader\Word2007;

use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\TrackChange;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWordTests\AbstractTestReader;

/**
Expand Down Expand Up @@ -60,7 +62,7 @@ public function testReadAlternateContent(): void

$elements = $phpWord->getSection(0)->getElements();
self::assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]);
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $elements[0]->getElement(0));
self::assertInstanceOf(Text::class, $elements[0]->getElement(0));
$text = $elements[0];
self::assertEquals('Test node value', trim($text->getElement(0)->getText()));
}
Expand All @@ -84,7 +86,7 @@ public function testReadTextBreak(): void
/** @var \PhpOffice\PhpWord\Element\TextRun $textRun */
$textRun = $elements[0];
self::assertInstanceOf('PhpOffice\PhpWord\Element\TextBreak', $textRun->getElement(0));
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(1));
self::assertInstanceOf(Text::class, $textRun->getElement(1));
self::assertEquals('test string', $textRun->getElement(1)->getText());
}

Expand All @@ -107,7 +109,7 @@ public function testSmartTag(): void
self::assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]);
/** @var \PhpOffice\PhpWord\Element\TextRun $textRun */
$textRun = $elements[0];
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(0));
self::assertInstanceOf(Text::class, $textRun->getElement(0));
self::assertEquals('test string', $textRun->getElement(0)->getText());
}

Expand Down Expand Up @@ -145,11 +147,20 @@ public function testReadListItemRunWithFormatting(): void
self::assertEquals(0, $sections->getElement(0)->getDepth());

$listElements = $sections->getElement(0)->getElements();
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $listElements[0]);
self::assertEquals('Two', $listElements[0]->getText());
self::assertEquals(' with ', $listElements[1]->getText());
self::assertEquals('bold', $listElements[2]->getText());
self::assertTrue($listElements[2]->getFontStyle()->isBold());
/** @var Text $listElement0 */
$listElement0 = $listElements[0];
self::assertInstanceOf(Text::class, $listElement0);
self::assertEquals('Two', $listElement0->getText());
/** @var Text $listElement1 */
$listElement1 = $listElements[1];
self::assertEquals(' with ', $listElement1->getText());
/** @var Text $listElement2 */
$listElement2 = $listElements[2];
self::assertEquals('bold', $listElement2->getText());
/** @var Font $listElement2FontStyle */
$listElement2FontStyle = $listElement2->getFontStyle();
self::assertInstanceOf(Font::class, $listElement2FontStyle);
self::assertTrue($listElement2FontStyle->isBold());
}

/**
Expand Down Expand Up @@ -214,11 +225,11 @@ public function testReadTab(): void
self::assertInstanceOf('PhpOffice\PhpWord\Element\TextRun', $elements[0]);
/** @var \PhpOffice\PhpWord\Element\TextRun $textRun */
$textRun = $elements[0];
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(0));
self::assertInstanceOf(Text::class, $textRun->getElement(0));
self::assertEquals('One', $textRun->getElement(0)->getText());
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(1));
self::assertInstanceOf(Text::class, $textRun->getElement(1));
self::assertEquals("\t", $textRun->getElement(1)->getText());
self::assertInstanceOf('PhpOffice\PhpWord\Element\Text', $textRun->getElement(2));
self::assertInstanceOf(Text::class, $textRun->getElement(2));
self::assertEquals('Two', $textRun->getElement(2)->getText());
}

Expand Down

0 comments on commit d5ca5b4

Please sign in to comment.