コード例 #1
0
ファイル: FactoryTest.php プロジェクト: php-lug/lug
 public function testCreateWithoutOptions()
 {
     $this->resource->expects($this->once())->method('getModel')->will($this->returnValue($model = Fixture::class));
     $fixture = $this->factory->create();
     $this->assertInstanceOf($model, $fixture);
     $this->assertNull($fixture->getName());
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     $translatable = parent::create($options);
     $translatable->setLocales($this->localeContext->getLocales());
     $translatable->setFallbackLocale($this->localeContext->getFallbackLocale());
     $translatable->setTranslationClass($this->resource->getTranslation()->getModel());
     return $translatable;
 }
コード例 #3
0
ファイル: TranslatableFactory.php プロジェクト: php-lug/lug
 /**
  * {@inheritdoc}
  */
 public function create(array $options = [])
 {
     return parent::create(array_merge($options, ['locales' => $this->localeContext->getLocales(), 'fallbackLocale' => $this->localeContext->getFallbackLocale(), 'translationFactory' => $this->translationFactory]));
 }
コード例 #4
0
ファイル: FactoryTest.php プロジェクト: blazarecki/lug
 public function testCreate()
 {
     $this->resource->expects($this->once())->method('getModel')->will($this->returnValue($model = \stdClass::class));
     $this->assertInstanceOf($model, $this->factory->create());
 }