Exemplo n.º 1
0
 /**
  * Get adapter
  *
  * @return AdapterInterface
  */
 protected function getConnection()
 {
     if ($this->adapter === null) {
         $this->adapter = $this->adapterFactory->create();
     }
     return $this->adapter;
 }
 public function create(array $data = [])
 {
     if ($this->helper->isActiveEngine()) {
         $adapter = $this->objectManager->create('Celebros\\ConversionPro\\Model\\Search\\Adapter\\Celebros\\Adapter');
         return $adapter;
     }
     return parent::create($data);
 }
 /**
  * @expectedException \LogicException
  */
 public function testCreateLogicException()
 {
     $this->scopeConfig->expects($this->once())->method('getValue')->with($this->equalTo('some_path'), $this->equalTo('some_scopeType'))->will($this->returnValue('Class'));
     $this->adapterFactory->create(['input']);
 }
Exemplo n.º 4
0
 /**
  * @param AdapterFactory $adapterFactory
  */
 public function __construct(AdapterFactory $adapterFactory)
 {
     $this->adapter = $adapterFactory->create();
 }
Exemplo n.º 5
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testCreateExceptionThrown()
 {
     $adapter = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManager->expects($this->once())->method('create')->with($this->equalTo('ClassName'), $this->equalTo(['input']))->will($this->returnValue($adapter));
     $this->adapterFactory->create(['input']);
 }