UnifiedDifferTest.php 968 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of PHP CS Fixer.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. namespace PhpCsFixer\Tests\Differ;
  12. use PhpCsFixer\Differ\UnifiedDiffer;
  13. /**
  14. * @author SpacePossum
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\Differ\UnifiedDiffer
  19. */
  20. final class UnifiedDifferTest extends AbstractDifferTestCase
  21. {
  22. public function testDiffReturnsDiff()
  23. {
  24. $diff = <<<'TXT'
  25. --- Original
  26. +++ New
  27. @@ -1,7 +1,8 @@
  28. <?php
  29. class Foo extends Bar {
  30. - function __construct($foo, $bar) {
  31. + public function __construct($foo, $bar)
  32. + {
  33. $this->foo = $foo;
  34. $this->bar = $bar;
  35. }
  36. }
  37. \ No newline at end of file
  38. TXT;
  39. $differ = new UnifiedDiffer();
  40. $this->assertSame($diff, $differ->diff($this->oldCode(), $this->newCode()));
  41. }
  42. }