Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/3.x' into master
- Loading branch information
Showing
12 changed files
with
150 additions
and
13 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,43 @@ | ||
<?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\App\Admin; | ||
|
||
use Sonata\AdminBundle\Admin\AbstractAdmin; | ||
use Sonata\AdminBundle\Datagrid\ListMapper; | ||
use Sonata\AdminBundle\Form\FormMapper; | ||
use Sonata\AdminBundle\Show\ShowMapper; | ||
use Sonata\AdminBundle\Templating\TemplateRegistry; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
|
||
final class TranslatedAdmin extends AbstractAdmin | ||
{ | ||
protected function configureListFields(ListMapper $list): void | ||
{ | ||
$list->add('name_list', TemplateRegistry::TYPE_STRING); | ||
} | ||
|
||
protected function configureFormFields(FormMapper $form): void | ||
{ | ||
$form | ||
->add('name_form', TextType::class, ['help' => 'Help me!']) | ||
->ifTrue($this->getSubject()->isPublished) | ||
->add('datePublished') | ||
->ifEnd(); | ||
} | ||
|
||
protected function configureShowFields(ShowMapper $show): void | ||
{ | ||
$show->add('name_show', TemplateRegistry::TYPE_STRING); | ||
} | ||
} |
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,21 @@ | ||
<?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\App\Model; | ||
|
||
final class Translated | ||
{ | ||
public $nameForm; | ||
public $isPublished = true; | ||
public $datePublished; | ||
} |
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
48 changes: 48 additions & 0 deletions
48
tests/Functional/Translator/Extractor/AdminExtractorTest.php
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\Functional\Translator\Extractor; | ||
|
||
use Sonata\AdminBundle\Tests\App\AppKernel; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
final class AdminExtractorTest extends KernelTestCase | ||
{ | ||
public function testDebugMissingMessages(): void | ||
{ | ||
$tester = $this->createCommandTester(); | ||
$tester->execute(['locale' => 'en']); | ||
|
||
$this->assertRegExp('/group_label/', $tester->getDisplay()); | ||
$this->assertRegExp('/admin_label/', $tester->getDisplay()); | ||
$this->assertRegExp('/Name Show/', $tester->getDisplay()); | ||
$this->assertRegExp('/Name List/', $tester->getDisplay()); | ||
$this->assertRegExp('/Name Form/', $tester->getDisplay()); | ||
$this->assertRegExp('/Date Published/', $tester->getDisplay()); | ||
} | ||
|
||
protected static function getKernelClass(): string | ||
{ | ||
return AppKernel::class; | ||
} | ||
|
||
private function createCommandTester(): CommandTester | ||
{ | ||
$kernel = static::createKernel(); | ||
$application = new Application($kernel); | ||
|
||
return new CommandTester($application->find('debug:translation')); | ||
} | ||
} |
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