Debian Codegraph @

lib/3rdParty/composer/symfony/translation/Test/ProviderFactoryTestCase.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Translation\Test;
13
14 use PHPUnit\Framework\MockObject\MockObject;
15 use Psr\Log\LoggerInterface;
16 use Symfony\Component\HttpClient\MockHttpClient;
17 use Symfony\Component\Translation\Dumper\XliffFileDumper;
18 use Symfony\Component\Translation\Loader\LoaderInterface;
19 use Symfony\Component\Translation\TranslatorBagInterface;
20 use Symfony\Contracts\HttpClient\HttpClientInterface;
21
22 /**
23 * A test case to ease testing a translation provider factory.
24 *
25 * @author Mathieu Santostefano <[email protected]>
26 *
27 * @deprecated since Symfony 7.2, use AbstractProviderFactoryTestCase instead
28 */
29 abstract class ProviderFactoryTestCase extends AbstractProviderFactoryTestCase
30 {
31 use IncompleteDsnTestTrait;
32
33 protected HttpClientInterface $client;
34 protected LoggerInterface|MockObject $logger;
35 protected string $defaultLocale;
36 protected LoaderInterface|MockObject $loader;
37 protected XliffFileDumper|MockObject $xliffFileDumper;
38 protected TranslatorBagInterface|MockObject $translatorBag;
39
40 /**
41 * @return iterable<array{0: string, 1?: string|null}>
42 */
43 public static function unsupportedSchemeProvider(): iterable
44 {
45 return [];
46 }
47
48 /**
49 * @return iterable<array{0: string, 1?: string|null}>
50 */
51 public static function incompleteDsnProvider(): iterable
52 {
53 return [];
54 }
55
56 protected function getClient(): HttpClientInterface
57 {
58 return $this->client ??= new MockHttpClient();
59 }
60
61 protected function getLogger(): LoggerInterface
62 {
63 return $this->logger ??= $this->createMock(LoggerInterface::class);
64 }
65
66 protected function getDefaultLocale(): string
67 {
68 return $this->defaultLocale ??= 'en';
69 }
70
71 protected function getLoader(): LoaderInterface
72 {
73 return $this->loader ??= $this->createMock(LoaderInterface::class);
74 }
75
76 protected function getXliffFileDumper(): XliffFileDumper
77 {
78 return $this->xliffFileDumper ??= $this->createMock(XliffFileDumper::class);
79 }
80
81 protected function getTranslatorBag(): TranslatorBagInterface
82 {
83 return $this->translatorBag ??= $this->createMock(TranslatorBagInterface::class);
84 }
85 }