示例#1
0
 /**
  * Returns cached instance of a FeedWriter for a specific type.
  *
  * @param FeedTypeInterface $type
  *
  * @return FeedWriter
  */
 protected function getWriter(FeedTypeInterface $type)
 {
     if (!array_key_exists($type->getName(), $this->writers)) {
         $this->writers[$type->getName()] = $this->writerFactory->createWriter($type);
     }
     return $this->writers[$type->getName()];
 }
 public function testCreateWriter()
 {
     $factory = new FeedWriterFactory($this->getMockForAbstractClass(EngineInterface::class));
     $writer = $factory->createWriter($this->getMockForAbstractClass(FeedTypeInterface::class));
     $this->assertInstanceOf(FeedWriter::class, $writer);
 }