Skip to content

Commit

Permalink
Always set LANGUAGE environment variable when setting LC_ALL. Fixes #816
Browse files Browse the repository at this point in the history
  • Loading branch information
osma committed Nov 20, 2018
1 parent 06e1296 commit 0af2043
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function setLanguageProperties($lang)
{
if (array_key_exists($lang, $this->languages)) {
$locale = $this->languages[$lang]['locale'];
putenv("LANGUAGE=$locale");
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
} else {
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptMappingPropertyValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ConceptMappingPropertyValueTest extends PHPUnit\Framework\TestCase
private $props;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ConceptPropertyTest extends PHPUnit\Framework\TestCase
private $model;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptPropertyValueLiteralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ConceptPropertyValueLiteralTest extends PHPUnit\Framework\TestCase
private $vocab;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptPropertyValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ConceptPropertyValueTest extends PHPUnit\Framework\TestCase
private $vocab;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptSearchParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ConceptSearchParametersTest extends PHPUnit\Framework\TestCase
private $request;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->request = $this->getMockBuilder('Request')->disableOriginalConstructor()->getMock();
Expand Down
1 change: 1 addition & 0 deletions tests/ConceptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ConceptTest extends PHPUnit\Framework\TestCase
private $cbdGraph;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
1 change: 1 addition & 0 deletions tests/GenericSparqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class GenericSparqlTest extends PHPUnit\Framework\TestCase
private $params;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
Expand Down
1 change: 1 addition & 0 deletions tests/JenaTextSparqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class JenaTextSparqlTest extends PHPUnit\Framework\TestCase
private $params;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/jenatestconfig.ttl'));
Expand Down
1 change: 1 addition & 0 deletions tests/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ModelTest extends PHPUnit\Framework\TestCase
private $model;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
Expand Down
1 change: 1 addition & 0 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class RequestTest extends PHPUnit\Framework\TestCase
private $request;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down
3 changes: 2 additions & 1 deletion tests/RestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
class RestControllerTest extends \PHPUnit\Framework\TestCase
{
protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
bindtextdomain('skosmos', 'resource/translations');
Expand Down Expand Up @@ -60,4 +61,4 @@ public function testSearchJsonLdWithAdditionalFields() {

$this->assertJsonStringEqualsJsonString('{"@context":{"skos":"http:\/\/www.w3.org\/2004\/02\/skos\/core#","isothes":"http:\/\/purl.org\/iso25964\/skos-thes#","onki":"http:\/\/schema.onki.fi\/onki#","uri":"@id","type":"@type","results":{"@id":"onki:results","@container":"@list"},"prefLabel":"skos:prefLabel","altLabel":"skos:altLabel","hiddenLabel":"skos:hiddenLabel","broader":"skos:broader","relatedMatch":"skos:relatedMatch"},"uri":"","results":[{"uri":"http:\/\/www.skosmos.skos\/test\/ta117","type":["skos:Concept","meta:TestClass"],"broader":[{"uri":"http:\/\/www.skosmos.skos\/test\/ta1"}],"relatedMatch":[{"uri":"http:\/\/www.skosmos.skos\/test\/ta115"}],"prefLabel":"3D Bass","lang":"en","vocab":"test"},{"uri":"http:\/\/www.skosmos.skos\/test\/ta116","type":["skos:Concept","meta:TestClass"],"broader":[{"uri":"http:\/\/www.skosmos.skos\/test\/ta1"}],"prefLabel":"Bass","lang":"en","vocab":"test"},{"uri":"http:\/\/www.skosmos.skos\/test\/ta122","type":["skos:Concept","meta:TestClass"],"broader":[{"uri":"http:\/\/www.skosmos.skos\/test\/ta116"}],"prefLabel":"Black sea bass","lang":"en","vocab":"test"}]}', $out);
}
}
}
1 change: 1 addition & 0 deletions tests/VocabularyCategoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class VocabularyCategoryTest extends PHPUnit\Framework\TestCase
private $mockres;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
Expand Down
1 change: 1 addition & 0 deletions tests/VocabularyConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class VocabularyConfigTest extends PHPUnit\Framework\TestCase
* @throws Exception
*/
protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
Expand Down
1 change: 1 addition & 0 deletions tests/VocabularyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class VocabularyTest extends \PHPUnit\Framework\TestCase
private $model;

protected function setUp() {
putenv("LANGUAGE=en_GB.utf8");
putenv("LC_ALL=en_GB.utf8");
setlocale(LC_ALL, 'en_GB.utf8');
$this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl'));
Expand Down

0 comments on commit 0af2043

Please sign in to comment.