-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
165 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\Fixtures; | ||
|
||
use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface; | ||
use Symfony\Contracts\Translation\TranslatorInterface; | ||
|
||
if (interface_exists(TranslatorInterface::class)) { | ||
final class StubTranslator implements TranslatorInterface | ||
{ | ||
public function trans($id, array $parameters = [], $domain = null, $locale = null): string | ||
{ | ||
return '[trans]'.strtr($id, $parameters).'[/trans]'; | ||
} | ||
} | ||
} else { | ||
final class StubTranslator implements LegacyTranslatorInterface | ||
{ | ||
public function trans($id, array $parameters = [], $domain = null, $locale = null) | ||
{ | ||
return '[trans]'.$id.'[/trans]'; | ||
} | ||
|
||
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) | ||
{ | ||
return '[trans]'.$id.'[/trans]'; | ||
} | ||
|
||
public function setLocale($locale) | ||
{ | ||
} | ||
|
||
public function getLocale() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\AdminBundle\Tests\Fixtures; | ||
|
||
use Symfony\Component\Form\FormExtensionInterface; | ||
use Symfony\Component\Form\FormTypeExtensionInterface; | ||
use Symfony\Component\Form\FormTypeGuesserInterface; | ||
use Symfony\Component\Form\FormTypeInterface; | ||
|
||
class TestExtension implements FormExtensionInterface | ||
{ | ||
private $types = []; | ||
private $extensions = []; | ||
private $guesser; | ||
|
||
public function __construct(FormTypeGuesserInterface $guesser) | ||
{ | ||
$this->guesser = $guesser; | ||
} | ||
|
||
public function addType(FormTypeInterface $type) | ||
{ | ||
$this->types[\get_class($type)] = $type; | ||
} | ||
|
||
public function getType($name): FormTypeInterface | ||
{ | ||
return isset($this->types[$name]) ? $this->types[$name] : null; | ||
} | ||
|
||
public function hasType($name): bool | ||
{ | ||
return isset($this->types[$name]); | ||
} | ||
|
||
public function addTypeExtension(FormTypeExtensionInterface $extension) | ||
{ | ||
foreach ($extension::getExtendedTypes() as $type) { | ||
if (!isset($this->extensions[$type])) { | ||
$this->extensions[$type] = []; | ||
} | ||
$this->extensions[$type][] = $extension; | ||
} | ||
} | ||
|
||
public function getTypeExtensions($name): array | ||
{ | ||
return isset($this->extensions[$name]) ? $this->extensions[$name] : []; | ||
} | ||
|
||
public function hasTypeExtensions($name): bool | ||
{ | ||
return isset($this->extensions[$name]); | ||
} | ||
|
||
public function getTypeGuesser(): ?FormTypeGuesserInterface | ||
{ | ||
return $this->guesser; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters