10 use PHPUnit4And6Compat;
16 use PHPUnit4And6Compat;
22 $updater->isDirectory(
'/IP/extensions/Translate/i18n/*.json' ),
23 'Extension json files are a file pattern'
27 $updater->isDirectory(
'/IP/extensions/Translate/Translate.i18n.php' ),
28 'Extension php file is not a pattern'
34 $repos = [
'main' =>
'file:///repos/%NAME%/%SOME-VAR%' ];
42 'file:///repos/product/file',
43 $updater->expandRemotePath( $info, $repos ),
44 'Variables are expanded correctly'
49 $updater = $updater =
new Updater();
51 $input = [
'file' =>
'Hello World!' ];
52 $output = [
'en' => [
'key' => $input[
'file'] ] ];
54 $reader = $this->getMock(
'LocalisationUpdate\Reader' );
56 ->expects( $this->once() )
58 ->will( $this->returnValue(
$output ) );
60 $factory = $this->getMock(
'LocalisationUpdate\ReaderFactory' );
62 ->expects( $this->once() )
63 ->method(
'getReader' )
64 ->will( $this->returnValue( $reader ) );
66 $observed = $updater->readMessages( $factory, $input );
67 $this->assertEquals(
$output, $observed,
'Tries to parse given file' );
71 $updater = $updater =
new Updater();
84 $blacklist = [
'D' => 0 ];
85 $expected = [
'B' =>
'2',
'C' =>
'33' ];
86 $observed = $updater->findChangedTranslations( $origin, $remote, $blacklist );
87 $this->assertEquals( $expected, $observed,
'Changed and new keys returned' );