Skip to content

Commit

Permalink
Merge pull request #9156 from vimeo/indent-docblocks-in-tests
Browse files Browse the repository at this point in the history
Indent docblocks in DocComment test
  • Loading branch information
orklah committed Jan 20, 2023
2 parents a4d1b06 + bf99b76 commit 9e34de5
Showing 1 changed file with 80 additions and 66 deletions.
146 changes: 80 additions & 66 deletions tests/DocCommentTest.php
Expand Up @@ -36,17 +36,19 @@ public function testNewLineIsAddedBetweenAnnotationsByDefault(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand Down Expand Up @@ -74,15 +76,17 @@ public function testNewLineIsNotAddedBetweenAnnotationsIfDisabled(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
* @throws \Exception
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
* @throws \Exception
* @return bool
*/
PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand Down Expand Up @@ -110,17 +114,19 @@ public function testNewLineIsAddedBetweenAnnotationsIfEnabled(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand All @@ -129,17 +135,19 @@ public function testParsingRoundtrip(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
PHP;
$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand All @@ -151,17 +159,21 @@ public function testParsingWithIndentation(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
PHP
. " ";

$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand All @@ -173,19 +185,21 @@ public function testParsingWithCommonPrefixes(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some self-referential desc with " * @return bool
* " as part of it.
*
* @param string $bli
* @param string $bli_this_suffix_is_kept
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some self-referential desc with " * @return bool
* " as part of it.
*
* @param string $bli
* @param string $bli_this_suffix_is_kept
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
PHP;
$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand Down

0 comments on commit 9e34de5

Please sign in to comment.