Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5fc67a

Browse filesBrowse files
committed
Fix Lokalise base_uri
1 parent 04bee3e commit e5fc67a
Copy full SHA for e5fc67a

File tree

2 files changed

+21
-1
lines changed
Filter options

2 files changed

+21
-1
lines changed

‎src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProviderFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Bridge/Lokalise/LokaliseProviderFactory.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function create(Dsn $dsn): ProviderInterface
5454
$endpoint .= $dsn->getPort() ? ':'.$dsn->getPort() : '';
5555

5656
$client = $this->client->withOptions([
57-
'base_uri' => 'https://'.$endpoint.'/projects/'.$this->getUser($dsn).'/api2/',
57+
'base_uri' => 'https://'.$endpoint.'/api2/projects/'.$this->getUser($dsn).'/',
5858
'headers' => [
5959
'X-Api-Token' => $this->getPassword($dsn),
6060
],

‎src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Bridge/Lokalise/Tests/LokaliseProviderFactoryTest.php
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
namespace Symfony\Component\Translation\Bridge\Lokalise\Tests;
44

5+
use Symfony\Component\HttpClient\MockHttpClient;
56
use Symfony\Component\Translation\Bridge\Lokalise\LokaliseProviderFactory;
7+
use Symfony\Component\Translation\Provider\Dsn;
68
use Symfony\Component\Translation\Provider\ProviderFactoryInterface;
79
use Symfony\Component\Translation\Test\ProviderFactoryTestCase;
10+
use Symfony\Contracts\HttpClient\HttpClientInterface;
811

912
class LokaliseProviderFactoryTest extends ProviderFactoryTestCase
1013
{
@@ -32,6 +35,23 @@ public function incompleteDsnProvider(): iterable
3235
yield ['lokalise://default'];
3336
}
3437

38+
public function testBaseUri()
39+
{
40+
$httpClient = $this->createMock(MockHttpClient::class);
41+
$httpClient
42+
->expects($this->once())
43+
->method('withOptions')
44+
->with([
45+
'base_uri' => 'https://api.lokalise.com/api2/projects/PROJECT_ID/',
46+
'headers' => [
47+
'X-Api-Token' => 'API_KEY',
48+
],
49+
]);
50+
51+
$factory = new LokaliseProviderFactory($httpClient, $this->getLogger(), $this->getDefaultLocale(), $this->getLoader());
52+
$factory->create(new Dsn('lokalise://PROJECT_ID:API_KEY@default'));
53+
}
54+
3555
public function createFactory(): ProviderFactoryInterface
3656
{
3757
return new LokaliseProviderFactory($this->getClient(), $this->getLogger(), $this->getDefaultLocale(), $this->getLoader());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.