-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1.2: Fix docs build Make tests great again Remove vendorPath command-line argument from root gulpfile Corrected the example in docs and added custom factory for testing Add ability to use a custom service as factory
- Loading branch information
Showing
8 changed files
with
123 additions
and
11 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
43 changes: 43 additions & 0 deletions
43
src/Sylius/Bundle/ResourceBundle/test/src/AppBundle/Factory/CustomBookFactory.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,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Factory; | ||
|
||
use AppBundle\Entity\Book; | ||
use Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface; | ||
|
||
final class CustomBookFactory | ||
{ | ||
/** @var string */ | ||
private $className; | ||
|
||
/** @var TranslationLocaleProviderInterface */ | ||
private $localeProvider; | ||
|
||
public function __construct(string $className, TranslationLocaleProviderInterface $localeProvider) | ||
{ | ||
$this->className = $className; | ||
$this->localeProvider = $localeProvider; | ||
} | ||
|
||
public function createCustom(): Book | ||
{ | ||
/** @var Book $book */ | ||
$book = new $this->className; | ||
|
||
$book->setCurrentLocale($this->localeProvider->getDefaultLocaleCode()); | ||
$book->setFallbackLocale($this->localeProvider->getDefaultLocaleCode()); | ||
|
||
return $book; | ||
} | ||
} |
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