Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
LokaliseProviderFactory example
public
static
function
incompleteDsnProvider
(
)
: iterable
{
yield
[
'lokalise://default'
]
;
}
public
function
testBaseUri
(
)
{
$response
=
new
MockResponse
(
json_encode
(
[
'files' =>
[
]
]
)
)
;
$httpClient
=
new
MockHttpClient
(
[
$response
]
)
;
$factory
=
new
LokaliseProviderFactory
(
$httpClient
,
$this
->
getLogger
(
)
,
$this
->
getDefaultLocale
(
)
,
$this
->
getLoader
(
)
)
;
$provider
=
$factory
->
create
(
new
Dsn
(
'lokalise://PROJECT_ID:API_KEY@default'
)
)
;
// Make a real HTTP request.
$provider
->
read
(
[
'messages'
]
,
[
'en'
]
)
;
$this
->
assertMatchesRegularExpression
(
'/https:\/\/api.lokalise.com\/api2\/projects\/PROJECT_ID\/*/',
$response
->
getRequestUrl
(
)
)
;
}
public
function
createFactory
(
)
: ProviderFactoryInterface
{
return
new
LokaliseProviderFactory
(
$this
->
getClient
(
)
,
$this
->
getLogger
(
)
,
$this
->
getDefaultLocale
(
)
,
$this
->
getLoader
(
)
)
;
}