コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function transform($package)
 {
     if (!$package instanceof PackageInterface) {
         throw new TransformationFailedException(sprintf('Expected a %s!', PackageInterface::class));
     }
     $article = $this->articleFactory->createFromPackage($package);
     return $article;
 }
コード例 #2
0
 public function it_should_transform_package_to_article(PackageInterface $package, ArticleFactoryInterface $articleFactory, ArticleInterface $article)
 {
     $package->getHeadline()->willReturn('headline');
     $package->getSlugline()->willReturn('slug');
     $package->getLanguage()->willReturn('en');
     $article->getTitle()->willReturn('headline');
     $article->getSlug()->willReturn('slug');
     $article->getLocale()->willReturn('en');
     $articleFactory->createFromPackage($package)->willReturn($article);
     $this->transform($package)->shouldReturn($article);
 }