8000 Merge branch '2.3' into 2.7 · symfony/symfony@ffdab92 · GitHub
[go: up one dir, main page]

Skip to content

Commit ffdab92

Browse files
committed
Merge branch '2.3' into 2.7
Conflicts: .travis.yml src/Symfony/Component/Translation/Loader/XliffFileLoader.php
2 parents c9e63f8 + 4ca74b0 commit ffdab92

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ matrix:
1717
env: deps=low
1818
- php: 5.6
1919
env: deps=high
20-
- php: nightly
20+
- php: 7.0
2121
fast_finish: true
2222

2323
services: mongodb
@@ -30,12 +30,13 @@ env:
3030
before_install:
3131
- composer self-update
3232
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
33-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
34-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
35-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
36-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
37-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
38-
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
33+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
34+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
35+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
36+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
37+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
38+
- if [[ "$TRAVIS_PHP_VERSION" != "7.0" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
39+
3940
# Build a standalone phpunit without symfony/yaml and that works around https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223
4041
- (mkdir phpunit && cd phpunit && wget https://github.com/sebastianbergmann/phpunit/archive/4.7.zip && unzip 4.7.zip && cd phpunit-4.7 && composer remove --no-update symfony/yaml && composer require --prefer-source phpunit/phpunit-mock-objects '2.3.0')
4142
- export PHPUNIT="$(readlink -f ./phpunit/phpunit-4.7/phpunit) --colors=always"

src/Symfony/Component/Translation/Loader/XliffFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ public function load($resource, $locale, $domain = 'messages')
4848
foreach ($xml->xpath('//xliff:trans-unit') as $translation) {
4949
$attributes = $translation->attributes();
5050

51-
if (!(isset($attributes['resname']) || isset($translation->source)) || !isset($translation->target)) {
51+
if (!(isset($attributes['resname']) || isset($translation->source))) {
5252
continue;
5353
}
5454

5555
$source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
5656
// If the xlf file has another encoding specified, try to convert it because
5757
// simple_xml will always return utf-8 encoded values
58-
$target = $this->utf8ToCharset((string) $translation->target, $encoding);
58+
$target = $this->utf8ToCharset((string) isset($translation->target) ? $translation->target : $source, $encoding);
5959

6060
$catalogue->set((string) $source, $target, $domain);
6161

src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public function testIncompleteResource()
5555
$loader = new XliffFileLoader();
5656
$catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1');
5757

58-
$this->assertEquals(array('foo' => 'bar', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
59-
$this->assertFalse($catalogue->has('extra', 'domain1'));
58+
$this->assertEquals(array('foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
6059
}
6160

6261
public function testEncoding()
@@ -136,7 +135,8 @@ public function testLoadNotes()
136135

137136
$this->assertEquals(array('notes' => array(array('priority' => 1, 'content' => 'foo'))), $catalogue->getMetadata('foo', 'domain1'));
138137
// message without target
139-
$this->assertNull($catalogue->getMetadata('extra', 'domain1'));
138+
$this->assertEquals(array('notes' => array(array('content' => 'bar', 'from' => 'foo'))), $catalogue->getMetadata('extra', 'domain1'));
139+
// message with empty target
140140
$this->assertEquals(array('notes' => array(array('content' => 'baz'), array('priority' => 2, 'from' => 'bar', 'content' => 'qux'))), $catalogue->getMetadata('key', 'domain1'));
141141
}
142142
}

0 commit comments

Comments
 (0)
0