-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #934 Reproduce getting the translation repository by its interf…
…ace use case (loic425) This PR was merged into the 1.11 branch. Discussion ---------- | Q | A | --------------- | ----- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT On 1.12 branch  Commits ------- b4e0976 Reproduce getting the translation repository by its interface use case
- Loading branch information
Showing
4 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Entity; | ||
|
||
use Sylius\Resource\Model\ResourceInterface; | ||
|
||
interface BookTranslationInterface extends ResourceInterface | ||
{ | ||
public function getTitle(): ?string; | ||
|
||
public function setTitle(?string $title): void; | ||
} |
37 changes: 37 additions & 0 deletions
37
tests/Bundle/EventListener/ORMTranslatableListenerTest.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,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bundle\EventListener; | ||
|
||
use App\Entity\BookTranslationInterface; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Doctrine\ORM\EntityRepository; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
|
||
final class ORMTranslatableListenerTest extends KernelTestCase | ||
{ | ||
public function testGettingTranslationRepositoryByItsInterface(): void | ||
{ | ||
self::bootKernel(); | ||
|
||
$this->assertInstanceOf( | ||
EntityRepository::class, | ||
$this->getEntityManager()->getRepository(BookTranslationInterface::class), | ||
); | ||
} | ||
|
||
private function getEntityManager(): EntityManagerInterface | ||
{ | ||
return $this->getContainer()->get(EntityManagerInterface::class); | ||
} | ||
} |