2023-07-03 08:27:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
2024-02-20 12:20:28 +00:00
|
|
|
namespace MediaWiki\Tests\Diff\TextDiffer;
|
2023-07-03 08:27:47 +00:00
|
|
|
|
|
|
|
|
use MediaWiki\Diff\TextDiffer\ExternalTextDiffer;
|
|
|
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers \MediaWiki\Diff\TextDiffer\ExternalTextDiffer
|
|
|
|
|
*/
|
|
|
|
|
class ExternalTextDifferTest extends MediaWikiIntegrationTestCase {
|
|
|
|
|
public function testRender() {
|
|
|
|
|
if ( !is_executable( '/bin/sh' ) ) {
|
|
|
|
|
$this->markTestSkipped( 'ExternalTextDiffer can\'t pass extra ' .
|
|
|
|
|
'arguments like $wgPhpCli, so it\'s hard to be platform-independent' );
|
|
|
|
|
}
|
|
|
|
|
$oldText = 'foo';
|
|
|
|
|
$newText = 'bar';
|
|
|
|
|
$differ = new ExternalTextDiffer( __DIR__ . '/externalDiffTest.sh' );
|
|
|
|
|
$result = $differ->render( $oldText, $newText, 'external' );
|
|
|
|
|
$this->assertSame( "- foo\n+ bar\n", $result );
|
|
|
|
|
}
|
|
|
|
|
}
|