public function test_populateSelect() { /** === Test Data === */ $TBL_SALE_ORDER = 'sale order table'; $mCollection = $this->_mock(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection::class); /** === Setup Mocks === */ // $select = $collection->getSelect(); $mSelect = $this->_mockDbSelect(['joinLeft']); $mCollection->shouldReceive('getSelect')->once()->andReturn($mSelect); // $tbl = [self::AS_TBL_ODOO_SALE => $this->_resource->getTableName(SaleOrder::ENTITY_NAME)]; $this->mResource->shouldReceive('getTableName')->once()->with(\Praxigento\Odoo\Data\Entity\SaleOrder::ENTITY_NAME)->andReturn(); /** === Call and asserts === */ $this->obj->populateSelect($mCollection); }
public function test_populateSelect() { /** === Test Data === */ $TBL_CUSTOMER = 'customer table'; $mCollection = $this->_mock(\Magento\Customer\Model\ResourceModel\Grid\Collection::class); /** === Setup Mocks === */ // $select = $collection->getSelect(); $mSelect = $this->_mockDbSelect(['joinLeft']); $mCollection->shouldReceive('getSelect')->once()->andReturn($mSelect); // $tbl = [self::AS_TBL_CUST => $this->_resource->getTableName(Customer::ENTITY_NAME)]; // $tbl = [self::AS_TBL_PARENT_CUST => $this->_resource->getTableName(Customer::ENTITY_NAME)]; $this->mResource->shouldReceive('getTableName')->twice()->with(\Praxigento\Downline\Data\Entity\Customer::ENTITY_NAME)->andReturn($TBL_CUSTOMER); /** === Call and asserts === */ $this->obj->populateSelect($mCollection); }
public function test_populateSelect() { /** === Test Data === */ $TABLE = 'table'; $COLLECTION = $this->_mock(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection::class); /** === Setup Mocks === */ // $select = $collection->getSelect(); $mSelect = $this->_mockDbSelect(); $COLLECTION->shouldReceive('getSelect')->once()->andReturn($mSelect); // $tbl = [self::AS_TBL_PV_SALES => $this->_resource->getTableName(Sale::ENTITY_NAME)]; $this->mResource->shouldReceive('getTableName')->once()->andReturn($TABLE); // $select->joinLeft($tbl, $on, $cols); $mSelect->shouldReceive('joinLeft')->once(); /** === Call and asserts === */ $this->obj->populateSelect($COLLECTION); }