123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <?php
- /*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- * Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * 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;
- /**
- * @author Graham Campbell <graham@alt-three.com>
- *
- * @internal
- *
- * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer
- */
- final class PhpdocOrderFixerTest extends AbstractFixerTestCase
- {
- public function testNoChanges()
- {
- $expected = <<<'EOF'
- <?php
- /**
- * Do some cool stuff.
- *
- * @param EngineInterface $templating
- * @param string $name
- *
- * @throws Exception
- *
- * @return void|bar
- */
- EOF;
- $this->doTest($expected);
- }
- public function testOnlyParams()
- {
- $expected = <<<'EOF'
- <?php
- /**
- * @param EngineInterface $templating
- * @param string $name
- */
- EOF;
- $this->doTest($expected);
- }
- public function testOnlyReturns()
- {
- $expected = <<<'EOF'
- <?php
- /**
- *
- * @return void|bar
- *
- */
- EOF;
- $this->doTest($expected);
- }
- public function testEmpty()
- {
- $this->doTest('/***/');
- }
- public function testNoAnnotations()
- {
- $expected = <<<'EOF'
- <?php
- /**
- *
- *
- *
- */
- EOF;
- $this->doTest($expected);
- }
- public function testFixBasicCase()
- {
- $expected = <<<'EOF'
- <?php
- /**
- * @param string $foo
- * @throws Exception
- * @return bool
- */
- EOF;
- $input = <<<'EOF'
- <?php
- /**
- * @throws Exception
- * @return bool
- * @param string $foo
- */
- EOF;
- $this->doTest($expected, $input);
- }
- public function testFixCompeteCase()
- {
- $expected = <<<'EOF'
- <?php
- /**
- * Hello there!
- *
- * Long description
- * goes here.
- *
- * @internal
- *
- *
- * @custom Test!
- * asldnaksdkjasdasd
- *
- *
- *
- * @param string $foo
- * @param bool $bar Bar
- * @throws Exception|RuntimeException dfsdf
- * jkaskdnaksdnkasndansdnansdajsdnkasd
- * @return bool Return false on failure.
- * @return int Return the number of changes.
- */
- EOF;
- $input = <<<'EOF'
- <?php
- /**
- * Hello there!
- *
- * Long description
- * goes here.
- *
- * @internal
- *
- * @throws Exception|RuntimeException dfsdf
- * jkaskdnaksdnkasndansdnansdajsdnkasd
- *
- * @custom Test!
- * asldnaksdkjasdasd
- *
- *
- * @return bool Return false on failure.
- * @return int Return the number of changes.
- *
- * @param string $foo
- * @param bool $bar Bar
- */
- EOF;
- $this->doTest($expected, $input);
- }
- public function testExampleFromSymfony()
- {
- $expected = <<<'EOF'
- <?php
- /**
- * Renders a template.
- *
- * @param mixed $name A template name
- * @param array $parameters An array of parameters to pass to the template
- *
- * @throws \InvalidArgumentException if the template does not exist
- * @throws \RuntimeException if the template cannot be rendered
- * @return string The evaluated template as a string
- *
- */
- EOF;
- $input = <<<'EOF'
- <?php
- /**
- * Renders a template.
- *
- * @param mixed $name A template name
- * @param array $parameters An array of parameters to pass to the template
- *
- * @return string The evaluated template as a string
- *
- * @throws \InvalidArgumentException if the template does not exist
- * @throws \RuntimeException if the template cannot be rendered
- */
- EOF;
- $this->doTest($expected, $input);
- }
- }
|