* Dariusz Rumiński * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Tests\Fixer\Phpdoc; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; use PhpCsFixer\WhitespacesFixerConfig; /** * @author Graham Campbell * * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer> */ final class PhpdocSummaryFixerTest extends AbstractFixerTestCase { public function testFixWithTrailingSpace(): void { $expected = 'doTest($expected, $input); } public function testFix(): void { $expected = <<<'EOF' doTest($expected, $input); } public function testWithPeriod(): void { $expected = <<<'EOF' doTest($expected); } public function testWithQuestionMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithExclamationMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithInvertedQuestionMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithInvertedExclamationMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithUnicodeQuestionMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithUnicodeExclamationMark(): void { $expected = <<<'EOF' doTest($expected); } public function testWithJapanesePeriod(): void { $expected = <<<'EOF' doTest($expected); } public function testFixIncBlank(): void { $expected = <<<'EOF' doTest($expected, $input); } public function testFixMultiline(): void { $expected = <<<'EOF' doTest($expected, $input); } public function testWithList(): void { $expected = <<<'EOF' doTest($expected); } public function testWithTags(): void { $expected = <<<'EOF' doTest($expected, $input); } public function testWithLongDescription(): void { $expected = <<<'EOF' doTest($expected, $input); } public function testCrazyMultiLineComments(): void { $expected = <<<'EOF' [ * 'https://www.foo.com/{version}/', * ['version' => '123'] * ], * 'defaults' => [ * 'timeout' => 10, * 'allow_redirects' => false, * 'proxy' => '192.168.16.1:10' * ] * ]); * * @param _AutogeneratedInputConfiguration $config Client configuration settings * - base_url: Base URL of the client that is merged into relative URLs. * Can be a string or an array that contains a URI template followed * by an associative array of expansion variables to inject into the * URI template. * - handler: callable RingPHP handler used to transfer requests * - message_factory: Factory used to create request and response object * - defaults: Default request options to apply to each request * - emitter: Event emitter used for request events * - fsm: (internal use only) The request finite state machine. A * function that accepts a transaction and optional final state. The * function is responsible for transitioning a request through its * lifecycle events. * @param string $foo */ EOF; $input = <<<'EOF' [ * 'https://www.foo.com/{version}/', * ['version' => '123'] * ], * 'defaults' => [ * 'timeout' => 10, * 'allow_redirects' => false, * 'proxy' => '192.168.16.1:10' * ] * ]); * * @param _AutogeneratedInputConfiguration $config Client configuration settings * - base_url: Base URL of the client that is merged into relative URLs. * Can be a string or an array that contains a URI template followed * by an associative array of expansion variables to inject into the * URI template. * - handler: callable RingPHP handler used to transfer requests * - message_factory: Factory used to create request and response object * - defaults: Default request options to apply to each request * - emitter: Event emitter used for request events * - fsm: (internal use only) The request finite state machine. A * function that accepts a transaction and optional final state. The * function is responsible for transitioning a request through its * lifecycle events. * @param string $foo */ EOF; $this->doTest($expected, $input); } public function testWithNoDescription(): void { $expected = <<<'EOF' doTest($expected); } /** * @dataProvider provideWithInheritDocCases */ public function testWithInheritDoc(string $expected): void { $this->doTest($expected); } /** * @return iterable */ public static function provideWithInheritDocCases(): iterable { yield [ 'doTest($expected); } /** * @dataProvider provideMessyWhitespacesCases */ public function testMessyWhitespaces(string $expected, ?string $input = null): void { $this->fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n")); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideMessyWhitespacesCases(): iterable { yield [ "