@@ -368,6 +368,7 @@ public function testFullSvnWorkflowForUnchangedFileWithCache() {
368
368
];
369
369
$ expected = PhpcsMessages::fromArrays ([], 'bin/foobar.php ' );
370
370
$ cache = new TestCache ();
371
+ $ cache ->setEntry ('foobar.php ' , 'new ' , 'foobar.php ' , '' , $ this ->phpcs ->getResults ('STDIN ' , [20 , 21 ])->toPhpcsJson ());
371
372
$ cache ->setEntry ('foobar.php ' , 'old ' , '188280 ' , '' , $ this ->phpcs ->getResults ('STDIN ' , [20 , 21 ])->toPhpcsJson ());
372
373
$ messages = runSvnWorkflow ([$ svnFile ], $ options , $ shell , new CacheManager ($ cache ), '\PhpcsChangedTests\debug ' );
373
374
$ this ->assertEquals ($ expected ->getMessages (), $ messages ->getMessages ());
@@ -415,14 +416,27 @@ public function testFullSvnWorkflowForUnchangedFileWithoutPhpCsMessages() {
415
416
$ shell = new TestShell ([$ svnFile ]);
416
417
$ shell ->registerCommand ("svn diff 'foobar.php' " , $ this ->fixture ->getEmptyFileDiff ());
417
418
$ shell ->registerCommand ("svn info 'foobar.php' " , $ this ->fixture ->getSvnInfo ('foobar.php ' ));
418
- $ shell ->registerCommand ("svn cat 'foobar.php'|phpcs " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
419
- $ shell ->registerCommand ("cat 'foobar.php'|phpcs " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
419
+ $ shell ->registerCommand ("svn cat 'foobar.php' " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
420
+ $ shell ->registerCommand ("cat 'foobar.php' " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
420
421
$ options = [];
421
422
$ expected = PhpcsMessages::fromArrays ([], 'STDIN ' );
422
423
$ messages = runSvnWorkflow ([$ svnFile ], $ options , $ shell , new CacheManager (new TestCache ()), '\PhpcsChangedTests\debug ' );
423
424
$ this ->assertEquals ($ expected ->getMessages (), $ messages ->getMessages ());
424
425
}
425
426
427
+ public function testFullSvnWorkflowForChangedFileWithoutPhpCsMessagesLintsOnlyNewFile () {
428
+ $ svnFile = 'foobar.php ' ;
429
+ $ shell = new TestShell ([$ svnFile ]);
430
+ $ shell ->registerCommand ("svn diff 'foobar.php' " , $ this ->fixture ->getEmptyFileDiff ());
431
+ $ shell ->registerCommand ("svn info 'foobar.php' " , $ this ->fixture ->getSvnInfo ('foobar.php ' ));
432
+ $ shell ->registerCommand ("svn cat 'foobar.php' " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
433
+ $ shell ->registerCommand ("cat 'foobar.php' " , '{"totals":{"errors":0,"warnings":0,"fixable":0},"files":{"STDIN":{"errors":0,"warnings":0,"messages":[]}}} ' );
434
+ $ options = [];
435
+ runSvnWorkflow ([$ svnFile ], $ options , $ shell , new CacheManager (new TestCache ()), '\PhpcsChangedTests\debug ' );
436
+ $ this ->assertFalse ($ shell ->wasCommandCalled ("svn diff 'foobar.php' " ));
437
+ $ this ->assertFalse ($ shell ->wasCommandCalled ("svn cat 'foobar.php' " ));
438
+ }
439
+
426
440
public function testFullSvnWorkflowForNonSvnFile () {
427
441
$ this ->expectException (ShellException::class);
428
442
$ svnFile = 'foobar.php ' ;
@@ -442,7 +456,7 @@ public function testFullSvnWorkflowForNewFile() {
442
456
$ shell ->registerCommand ("svn info 'foobar.php' " , $ this ->fixture ->getSvnInfoNewFile ('foobar.php ' ));
443
457
$ shell ->registerCommand ("cat 'foobar.php' " , $ this ->phpcs ->getResults ('STDIN ' , [20 , 21 ])->toPhpcsJson ());
444
458
$ options = [];
445
- $ expected = $ this ->phpcs ->getResults ('STDIN ' , [20 , 21 ]);
459
+ $ expected = $ this ->phpcs ->getResults ('foobar.php ' , [20 , 21 ]);
446
460
$ messages = runSvnWorkflow ([$ svnFile ], $ options , $ shell , new CacheManager (new TestCache ()), '\PhpcsChangedTests\debug ' );
447
461
$ this ->assertEquals ($ expected ->getMessages (), $ messages ->getMessages ());
448
462
}
0 commit comments