Exemple #1
0
 public function testTypesOtherThanArrayAndStringCanBePassed()
 {
     $expected = "--- Original\n+++ New\n@@ @@\n-1\n+2\n";
     $diff = Diff::create(1, 2);
     $formatter = new Upstream();
     $this->assertEquals($expected, $formatter->format($diff));
 }
Exemple #2
0
 /**
  * @dataProvider lineEndingProvider
  */
 public function testLineEndingWarning($from, $to, $expectedFromEol, $expectedToEol)
 {
     $formatter = new Upstream();
     $diff = $formatter->format(Diff::create($from, $to));
     // No warning
     if ($expectedFromEol === null) {
         $this->assertNotRegExp('/#Warning: Line ending changed from .+ to .+$/m', $diff);
         return;
     }
     $fromEolName = (new EOL($expectedFromEol))->getName();
     $toEolName = (new EOL($expectedToEol))->getName();
     $pattern = sprintf('/^#Warning: Line ending changed from %s to %s$/m', preg_quote($fromEolName), preg_quote($toEolName));
     $this->assertRegExp($pattern, $diff);
 }