ReadmeTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*
  3. * This file is part of the PHP CS utility.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Symfony\CS\Tests;
  11. use Symfony\Component\Console\Input\ArrayInput;
  12. use Symfony\Component\Console\Output\BufferedOutput;
  13. use Symfony\CS\Console\Application;
  14. /**
  15. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  16. */
  17. class ReadmeTest extends \PHPUnit_Framework_TestCase
  18. {
  19. public function testIfReadmeFileIsCorrect()
  20. {
  21. if (!class_exists('Symfony\Component\Console\Output\BufferedOutput')) {
  22. $this->markTestSkipped('Unsupported symfony/console version, Symfony\Component\Console\Output\BufferedOutput was added in 2.4.');
  23. }
  24. $input = new ArrayInput(array('readme'));
  25. $output = new BufferedOutput();
  26. $app = new Application();
  27. $app->get('readme')->run($input, $output);
  28. $fileContent = file_get_contents(__DIR__.'/../../../README.rst');
  29. $this->assertSame(
  30. $output->fetch(),
  31. $fileContent,
  32. 'README.rst file is not up to date! Do not modify it manually! Regenerate readme with command: `php php-cs-fixer readme > README.rst`.'
  33. );
  34. }
  35. }