Esempio n. 1
0
 /**
  * Tests \Magento\Framework\Object->toArray()
  */
 public function testToArray()
 {
     $this->assertEquals([], $this->_object->toArray());
     $this->assertEquals(['key' => null], $this->_object->toArray(['key']));
     $this->_object->setData(['key1' => 'value1', 'key2' => 'value2']);
     $this->assertEquals(['key1' => 'value1'], $this->_object->toArray(['key1']));
     $this->assertEquals(['key2' => 'value2'], $this->_object->convertToArray(['key2']));
 }
Esempio n. 2
0
 /**
  * Tests \Magento\Framework\Object->toArray()
  */
 public function testToArray()
 {
     $this->assertEquals(array(), $this->_object->toArray());
     $this->assertEquals(array('key' => null), $this->_object->toArray(array('key')));
     $this->_object->setData(array('key1' => 'value1', 'key2' => 'value2'));
     $this->assertEquals(array('key1' => 'value1'), $this->_object->toArray(array('key1')));
     $this->assertEquals(array('key2' => 'value2'), $this->_object->convertToArray(array('key2')));
 }
Esempio n. 3
0
 public function execute()
 {
     $email = $this->getRequest()->getParam('email');
     //        $this->_objectManager->get('Ebizmarts\Mandrill\Helper\Data')->sendTestEmail($email);
     $template = "mandrill_test_template";
     $transport = $this->_transportBuilder->setTemplateIdentifier($template)->setFrom($this->_objectManager->get('Ebizmarts\\Mandrill\\Helper\\Data')->getTestSender())->addTo($email)->setTemplateVars([])->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1])->getTransport();
     $transport->sendMessage();
     $response = new Object();
     $response->setError(0);
     /** @var \Magento\Framework\Controller\Result\Json $resultJson */
     $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     $resultJson->setData($response->toArray());
     return $resultJson;
 }
Esempio n. 4
0
 /**
  * @return \Magento\Framework\Controller\Result\Json
  */
 public function execute()
 {
     $response = new Object();
     $id = $this->getRequest()->getParam('id');
     if (intval($id) > 0) {
         $product = $this->productRepository->getById($id);
         $response->setId($id);
         $response->addData($product->getData());
         $response->setError(0);
     } else {
         $response->setError(1);
         $response->setMessage(__('We can\'t retrieve the product ID.'));
     }
     /** @var \Magento\Framework\Controller\Result\Json $resultJson */
     $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     $resultJson->setData($response->toArray());
     return $resultJson;
 }