예제 #1
0
 public function setUp()
 {
     $this->templateFilter = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Template\\Filter')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->date = $this->getMockBuilder('\\Magento\\Framework\\Stdlib\\DateTime\\DateTime')->disableOriginalConstructor()->getMock();
     $this->templateFactory = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\TemplateFactory')->disableOriginalConstructor()->setMethods(['create', 'load'])->getMock();
     $this->problemFactory = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\ProblemFactory')->disableOriginalConstructor()->getMock();
     $this->transportBuilder = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Queue\\TransportBuilder')->disableOriginalConstructor()->setMethods(['setTemplateData', 'setTemplateOptions', 'setTemplateVars', 'setFrom', 'addTo', 'getTransport'])->getMock();
     $this->subscribersCollection = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Resource\\Subscriber\\Collection')->disableOriginalConstructor()->getMock();
     $this->resource = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Resource\\Queue')->disableOriginalConstructor()->getMock();
     $this->subscribersCollectionFactory = $this->getMockBuilder('\\Magento\\Newsletter\\Model\\Resource\\Subscriber\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->subscribersCollectionFactory->expects($this->any())->method('create')->willReturn($this->subscribersCollection);
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->queue = $this->objectManager->getObject('\\Magento\\Newsletter\\Model\\Queue', ['templateFilter' => $this->templateFilter, 'date' => $this->date, 'templateFactory' => $this->templateFactory, 'problemFactory' => $this->problemFactory, 'subscriberCollectionFactory' => $this->subscribersCollectionFactory, 'transportBuilder' => $this->transportBuilder, 'resource' => $this->resource]);
 }
예제 #2
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\View\DesignInterface $design
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Store\Model\App\Emulation $appEmulation
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Newsletter\Model\Template\Filter $templateFilter
  * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
  * @param \Magento\Framework\Stdlib\DateTime\DateTime $date
  * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory
  * @param \Magento\Newsletter\Model\ProblemFactory $problemFactory
  * @param \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory
  * @param \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Registry $registry, \Magento\Store\Model\App\Emulation $appEmulation, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Newsletter\Model\Template\Filter $templateFilter, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\ProblemFactory $problemFactory, \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory, \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder, array $data = [])
 {
     parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data);
     $this->_templateFilter = $templateFilter;
     $this->_date = $date;
     $this->_templateFactory = $templateFactory;
     $this->_problemFactory = $problemFactory;
     $this->_subscribersCollection = $subscriberCollectionFactory->create();
     $this->_transportBuilder = $transportBuilder;
 }
예제 #3
0
파일: Queue.php 프로젝트: nja78/magento2
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Newsletter\Model\Template\Filter $templateFilter
  * @param \Magento\Framework\Stdlib\DateTime\DateTime $date
  * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory
  * @param \Magento\Newsletter\Model\ProblemFactory $problemFactory
  * @param \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory
  * @param \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder
  * @param \Magento\Framework\Model\Resource\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Newsletter\Model\Template\Filter $templateFilter, \Magento\Framework\Stdlib\DateTime\DateTime $date, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Newsletter\Model\ProblemFactory $problemFactory, \Magento\Newsletter\Model\Resource\Subscriber\CollectionFactory $subscriberCollectionFactory, \Magento\Newsletter\Model\Queue\TransportBuilder $transportBuilder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $resource, $resourceCollection, $data);
     $this->_templateFilter = $templateFilter;
     $this->_date = $date;
     $this->_templateFactory = $templateFactory;
     $this->_problemFactory = $problemFactory;
     $this->_subscribersCollection = $subscriberCollectionFactory->create();
     $this->_transportBuilder = $transportBuilder;
 }