ReportSummaryTest.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. namespace PhpCsFixer\Tests\Console\Report\FixReport;
  13. use PhpCsFixer\Console\Report\FixReport\ReportSummary;
  14. use PhpCsFixer\Tests\TestCase;
  15. /**
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\Console\Report\FixReport\ReportSummary
  19. */
  20. final class ReportSummaryTest extends TestCase
  21. {
  22. public function testReportSummary(): void
  23. {
  24. $changed = [
  25. 'someFile.php' => [
  26. 'appliedFixers' => ['some_fixer_name_here'],
  27. 'diff' => 'this text is a diff ;)',
  28. ],
  29. ];
  30. $filesCount = 10;
  31. $time = time();
  32. $memory = 123_456_789;
  33. $addAppliedFixers = true;
  34. $isDryRun = true;
  35. $isDecoratedOutput = false;
  36. $reportSummary = new ReportSummary(
  37. $changed,
  38. $filesCount,
  39. $time,
  40. $memory,
  41. $addAppliedFixers,
  42. $isDryRun,
  43. $isDecoratedOutput
  44. );
  45. self::assertSame($changed, $reportSummary->getChanged());
  46. self::assertSame($filesCount, $reportSummary->getFilesCount());
  47. self::assertSame($time, $reportSummary->getTime());
  48. self::assertSame($memory, $reportSummary->getMemory());
  49. self::assertSame($addAppliedFixers, $reportSummary->shouldAddAppliedFixers());
  50. self::assertSame($isDryRun, $reportSummary->isDryRun());
  51. self::assertSame($isDecoratedOutput, $reportSummary->isDecoratedOutput());
  52. }
  53. }