public function test_create()
 {
     $bind = [DataEntity::ATTR_ASSET_TYPE_ID => 1, DataEntity::ATTR_CUST_ID => 1];
     $res = $this->_obj->create($bind);
     $this->assertTrue($res > 0);
     $bind = [DataEntityOther::ATTR_TYPE_ID => 1];
     $res = $this->_obj2->create($bind);
     $this->assertTrue($res > 0);
 }
 public function test_updateById_string()
 {
     /** === Test Data === */
     $ID = 'simple';
     $DATA = [[1], [2]];
     $UPDATED = 'rows updated';
     /** === Setup Mocks === */
     // $val = is_int($id) ? $id : $this->_conn->quote($id);
     $this->mConn->shouldReceive('quote')->once()->andReturn("'{$ID}'");
     // $result = $this->_repoGeneric->updateEntity($this->_entityName, $data, $where);
     $this->mRepoGeneric->shouldReceive('updateEntity')->once()->with($this->ENTITY_NAME, $DATA, $this->PK_ATTR . "='{$ID}'")->andReturn($UPDATED);
     /** === Call and asserts  === */
     $res = $this->obj->updateById($ID, $DATA);
     $this->assertEquals($UPDATED, $res);
 }
 public function create($data)
 {
     $result = parent::create($data);
     if ($result) {
         /* update balalnces for accounts */
         if (is_array($data)) {
             $data = new Entity($data);
         }
         $value = $data->getValue();
         $creditAccid = $data->getCreditAccId();
         $debitAccId = $data->getDebitAccId();
         $this->_repoAccount->updateBalance($creditAccid, 0 + $value);
         $this->_repoAccount->updateBalance($debitAccId, 0 - $value);
     }
     return $result;
 }
 public function __construct(\Magento\Framework\App\ResourceConnection $resource, \Praxigento\Core\Repo\IGeneric $repoGeneric)
 {
     parent::__construct($resource, $repoGeneric, Entity::class);
 }
Пример #5
0
 public function __construct(\Magento\Framework\ObjectManagerInterface $manObj, \Magento\Framework\App\ResourceConnection $resource, \Praxigento\Core\Repo\IGeneric $repoGeneric)
 {
     parent::__construct($resource, $repoGeneric, Entity::class);
     $this->_manObj = $manObj;
 }
Пример #6
0
 public function updateById($id, $data)
 {
     return parent::updateById($id, $data);
     // TODO: Change the autogenerated stub
 }
Пример #7
0
 public function __construct(ResourceConnection $resource, IRepoGeneric $repoGeneric)
 {
     parent::__construct($resource, $repoGeneric, Entity::class);
 }
 public function __construct(\Magento\Framework\App\ResourceConnection $resource, \Praxigento\Core\Repo\IGeneric $repoGeneric)
 {
     parent::__construct($resource, $repoGeneric, \Praxigento\Accounting\Data\Entity\Balance::class);
 }
 public function __construct(\Magento\Framework\App\ResourceConnection $resource, \Praxigento\Core\Repo\IGeneric $repoGeneric)
 {
     parent::__construct($resource, $repoGeneric, \Praxigento\BonusBase\Data\Entity\Calculation::class);
 }