Skip to content

Commit

Permalink
feature #58352 [Translation] deprecate the ProviderFactoryTestCase (x…
Browse files Browse the repository at this point in the history
…abbuh)

This PR was merged into the 7.2 branch.

Discussion
----------

[Translation] deprecate the ProviderFactoryTestCase

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Issues        |
| License       | MIT

Commits
-------

4463d664e3 deprecate the ProviderFactoryTestCase
  • Loading branch information
fabpot committed Sep 27, 2024
2 parents 4a58965 + fa2d852 commit 95244f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
13 changes: 10 additions & 3 deletions Tests/LocoProviderFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@

namespace Symfony\Component\Translation\Bridge\Loco\Tests;

use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Translation\Bridge\Loco\LocoProviderFactory;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\ProviderFactoryInterface;
use Symfony\Component\Translation\Test\ProviderFactoryTestCase;
use Symfony\Component\Translation\Test\AbstractProviderFactoryTestCase;
use Symfony\Component\Translation\Test\IncompleteDsnTestTrait;
use Symfony\Component\Translation\TranslatorBagInterface;

class LocoProviderFactoryTest extends ProviderFactoryTestCase
class LocoProviderFactoryTest extends AbstractProviderFactoryTestCase
{
use IncompleteDsnTestTrait;

public static function supportsProvider(): iterable
{
yield [true, 'loco://API_KEY@default'];
Expand Down Expand Up @@ -48,6 +55,6 @@ public static function incompleteDsnProvider(): iterable

public function createFactory(): ProviderFactoryInterface
{
return new LocoProviderFactory($this->getClient(), $this->getLogger(), $this->getDefaultLocale(), $this->getLoader(), $this->getTranslatorBag());
return new LocoProviderFactory(new MockHttpClient(), new NullLogger(), 'en', $this->createMock(LoaderInterface::class), $this->createMock(TranslatorBagInterface::class));
}
}
5 changes: 4 additions & 1 deletion Tests/LocoProviderFactoryWithoutTranslatorBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@

namespace Symfony\Component\Translation\Bridge\Loco\Tests;

use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Translation\Bridge\Loco\LocoProviderFactory;
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\Provider\ProviderFactoryInterface;

class LocoProviderFactoryWithoutTranslatorBagTest extends LocoProviderFactoryTest
{
public function createFactory(): ProviderFactoryInterface
{
return new LocoProviderFactory($this->getClient(), $this->getLogger(), $this->getDefaultLocale(), $this->getLoader(), null);
return new LocoProviderFactory(new MockHttpClient(), new NullLogger(), 'en', $this->createMock(LoaderInterface::class), null);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": ">=8.2",
"symfony/http-client": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/translation": "^6.4|^7.0"
"symfony/translation": "^7.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Translation\\Bridge\\Loco\\": "" },
Expand Down

0 comments on commit 95244f2

Please sign in to comment.